-
Notifications
You must be signed in to change notification settings - Fork 56
58 lines (50 loc) · 1.92 KB
/
flow-web.yaml
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
name: Flow-web CI
# Controls when the action will run. Triggers the workflow on push
# or pull request events, but only for the primary branch.
on:
push:
branches: [master]
paths:
- "crates/flow-web/**"
- "Cargo.lock"
pull_request:
branches: [master]
paths:
- ".github/workflows/flow-web.yaml"
- "crates/flow-web/**"
- "Cargo.lock"
jobs:
buildAndPublish:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-bindgen
run: |
curl -sSL https://github.com/rustwasm/wasm-bindgen/releases/download/0.2.93/wasm-bindgen-0.2.93-x86_64-unknown-linux-musl.tar.gz | tar -zxv
mv wasm-bindgen-0.2.93-x86_64-unknown-linux-musl/wasm* ~/.cargo/bin/
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build flow-web
run: wasm-pack build --scope estuary crates/flow-web --out-name flow_web
# Fix from: https://github.com/rustwasm/wasm-pack/issues/1039#issuecomment-1712491804
# We need to manually insert the main ref until this fix is published
# https://github.com/rustwasm/wasm-pack/pull/1061
- name: Manually update package.json
run: |
npm pkg set type='module' --prefix crates/flow-web/pkg
npm pkg set main='flow_web.js' --prefix crates/flow-web/pkg
- name: Publish flow-web
if: ${{ github.ref == 'refs/heads/master' }}
run: |
cd crates/flow-web/pkg
echo '//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}' > .npmrc
echo '@estuary:registry=https://npm.pkg.github.com' >> .npmrc
wasm-pack publish --access=public --tag=dev
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}