-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (54 loc) · 1.72 KB
/
build-wasm.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
name: Build WebAssembly
on:
workflow_call:
inputs:
release-tag:
required: true
type: string
jobs:
build:
name: Build
runs-on: ubuntu-22.04
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set release version
run: |
sed -i 's/version = "[0-9.]*"$/version = "${{ inputs.release-tag }}"/' Cargo.toml
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.70.0
target: wasm32-unknown-unknown
override: true
- name: Load Rust cache
uses: Swatinem/rust-cache@v2
- name: Install wasm-pack
uses: jetli/[email protected]
with:
version: v0.11.0
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
- name: Build
run: RUST_LOG=info wasm-pack build runtime/wasm --release
- name: Pack
working-directory: runtime/wasm/pkg
run: |
npm pkg set 'name'='@eddmann/santa-lang-wasm'
npm pkg set 'version'='${{ inputs.release-tag }}'
npm pkg set 'repository'='https://github.com/eddmann/santa-lang-rs'
npm pkg set 'publishConfig.registry'='https://npm.pkg.github.com'
wasm-pack pack
- name: Upload
run: |
cp runtime/wasm/pkg/eddmann-santa-lang-wasm-${{ inputs.release-tag }}.tgz santa-lang-wasm-${{ inputs.release-tag }}.tgz
gh release upload ${{ inputs.release-tag }} santa-lang-wasm-${{ inputs.release-tag }}.tgz --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}