-
-
Notifications
You must be signed in to change notification settings - Fork 258
69 lines (60 loc) · 2.05 KB
/
wasm_publish.yml
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
name: Manual NPM Package Publish
on:
workflow_dispatch:
inputs:
working_directory:
description: 'Working directory (e.g., libs/client-api-wasm)'
required: true
default: 'libs/client-api-wasm'
package_name:
description: 'Which package to publish'
required: true
default: '@appflowyinc/client-api-wasm'
type: choice
options:
- '@appflowyinc/client-api-wasm'
package_version:
description: 'Package version'
required: true
env:
NODE_VERSION: '20.12.0'
RUST_TOOLCHAIN: "1.80.0"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
AppFlowy-Cloud
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Build with wasm-pack
run: wasm-pack build --release
working-directory: ${{ github.event.inputs.working_directory }}
- name: Update name
working-directory: ${{ github.event.inputs.working_directory }}/pkg
run: |
jq '.name = "${{ github.event.inputs.package_name }}"' package.json > package.json.tmp
mv package.json.tmp package.json
- name: Update version
working-directory: ${{ github.event.inputs.working_directory }}/pkg
run: |
npm version ${{ github.event.inputs.package_version }}
- name: Configure npm for wasm-pack
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ${{ github.event.inputs.working_directory }}/pkg/.npmrc
- name: Publish package
run: |
npm config set access public
wasm-pack publish
working-directory: ${{ github.event.inputs.working_directory }}/pkg
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}