-
Notifications
You must be signed in to change notification settings - Fork 20
115 lines (96 loc) · 3.49 KB
/
typescript-adapter-release.yml
File metadata and controls
115 lines (96 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: TypeScript Adapter
on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish'
required: true
jobs:
build-wasm:
name: Build WebAssembly sandboxes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install capsule-run (PyPI)
run: pip install capsule-run
- name: Build python_sandbox.wasm
working-directory: integrations/typescript-adapter
run: |
mkdir -p dist/sandboxes
capsule build src/python_sandbox/index.py --export
mv src/python_sandbox/index.wasm dist/sandboxes/python_sandbox.wasm
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Install @capsule-run/cli (npm)
run: npm install -g @capsule-run/cli
- name: Install dependencies
working-directory: integrations/typescript-adapter
run: npm ci
- name: Build js_sandbox.wasm
working-directory: integrations/typescript-adapter
run: |
capsule build src/js_sandbox/index.ts --export
mv src/js_sandbox/index.wasm dist/sandboxes/js_sandbox.wasm
- name: Upload wasm sandboxes
uses: actions/upload-artifact@v4
with:
name: wasm-sandboxes
path: integrations/typescript-adapter/dist/sandboxes/
publish-adapter-typescript:
name: Publish @capsule-run/adapter
needs: build-wasm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Get version
id: version
run: |
VERSION="${{ github.event.release.tag_name || github.event.inputs.version }}"
VERSION="${VERSION#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if package version exists
id: check_version
run: |
if (npm view @capsule-run/adapter@${{ steps.version.outputs.version }} version) > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Install dependencies
if: steps.check_version.outputs.exists != 'true'
working-directory: integrations/typescript-adapter
run: npm ci
- name: Compile TypeScript
if: steps.check_version.outputs.exists != 'true'
working-directory: integrations/typescript-adapter
run: npm run build:ts
- name: Download wasm sandboxes
if: steps.check_version.outputs.exists != 'true'
uses: actions/download-artifact@v4
with:
name: wasm-sandboxes
path: integrations/typescript-adapter/dist/sandboxes/
- name: Set version
if: steps.check_version.outputs.exists != 'true'
working-directory: integrations/typescript-adapter
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version
- name: Publish
if: steps.check_version.outputs.exists != 'true'
working-directory: integrations/typescript-adapter
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}