Skip to content

Commit aabcc3c

Browse files
committed
refactor: add environment-specific entry points for WASM module loading
1 parent f27c5ec commit aabcc3c

File tree

22 files changed

+695
-354
lines changed

22 files changed

+695
-354
lines changed

.gitattributes

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Auto detect text files and perform LF normalization
2-
* text=auto
3-
*.ts linguist-detectable=false
4-
*.mjs linguist-detectable=false
5-
**/test_data/** linguist-detectable=false
2+
* text=auto eol=lf
3+
4+
justfile -linguist-detectable
5+
extra/** -linguist-detectable
6+
scripts/** -linguist-detectable
7+
test_*/** -linguist-detectable

.github/workflows/publish.yml

Lines changed: 105 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,112 @@
11
name: Publish
22

33
on:
4-
push:
5-
tags:
6-
- "v*"
4+
push:
5+
tags:
6+
- "v*"
77

88
env:
9-
CARGO_INCREMENTAL: 0
10-
CARGO_TERM_COLOR: "always"
11-
RUST_LOG: "off"
9+
CARGO_INCREMENTAL: 0
10+
CARGO_TERM_COLOR: "always"
11+
RUST_LOG: "off"
1212

1313
jobs:
14-
wasm-build:
15-
name: Wasm build
16-
runs-on: ubuntu-latest
17-
steps:
18-
- uses: actions/checkout@v6
19-
20-
- name: Install wasm-pack
21-
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
22-
23-
- name: Build wasm
24-
run: ./scripts/build.sh
25-
26-
- name: Upload
27-
uses: actions/upload-artifact@v6
28-
with:
29-
name: build
30-
path: pkg
31-
32-
publish-npm:
33-
if: startsWith(github.ref, 'refs/tags/v')
34-
runs-on: ubuntu-latest
35-
needs: wasm-build
36-
permissions:
37-
id-token: write
38-
steps:
39-
- uses: actions/checkout@v6
40-
- uses: actions/download-artifact@v7
41-
with:
42-
name: build
43-
path: pkg/
44-
45-
- uses: actions/setup-node@v6
46-
with:
47-
node-version-file: ".node-version"
48-
registry-url: "https://registry.npmjs.org"
49-
50-
- name: Publish
51-
working-directory: pkg
52-
run: npm publish --provenance
53-
54-
publish-jsr:
55-
if: startsWith(github.ref, 'refs/tags/v')
56-
runs-on: ubuntu-latest
57-
permissions:
58-
contents: read
59-
id-token: write
60-
needs: wasm-build
61-
steps:
62-
- uses: actions/checkout@v6
63-
- uses: actions/download-artifact@v7
64-
with:
65-
name: build
66-
path: pkg/
67-
68-
- uses: actions/setup-node@v6
69-
with:
70-
node-version-file: ".node-version"
71-
registry-url: "https://registry.npmjs.org"
72-
73-
- name: Publish
74-
working-directory: pkg
75-
run: npx jsr publish --allow-dirty
76-
77-
publish-github:
78-
if: startsWith(github.ref, 'refs/tags/v')
79-
runs-on: ubuntu-latest
80-
needs: wasm-build
81-
permissions:
82-
packages: write
83-
steps:
84-
- uses: actions/checkout@v6
85-
- uses: actions/download-artifact@v7
86-
with:
87-
name: build
88-
path: pkg/
89-
90-
- uses: actions/setup-node@v6
91-
with:
92-
node-version-file: ".node-version"
93-
registry-url: "https://npm.pkg.github.com"
94-
95-
- name: Publish
96-
working-directory: pkg
97-
run: npm publish
98-
env:
99-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100-
101-
publish-github-release:
102-
if: startsWith(github.ref, 'refs/tags/v')
103-
runs-on: ubuntu-latest
104-
needs: wasm-build
105-
permissions:
106-
contents: write
107-
steps:
108-
- uses: actions/checkout@v6
109-
- uses: actions/download-artifact@v7
110-
with:
111-
name: build
112-
path: pkg/
113-
114-
- name: Package
115-
working-directory: pkg
116-
run: npm pack
117-
118-
- name: Release
119-
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87
120-
with:
121-
files: |
122-
pkg/*.tgz
123-
pkg/*.wasm
14+
wasm-build:
15+
name: Wasm build
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
- uses: taiki-e/install-action@v2
20+
with:
21+
tool: wasm-pack,just
22+
- name: Build wasm
23+
run: just build
24+
- name: Upload
25+
uses: actions/upload-artifact@v6
26+
with:
27+
name: build
28+
path: pkg
29+
30+
publish-npm:
31+
if: startsWith(github.ref, 'refs/tags/v')
32+
runs-on: ubuntu-latest
33+
needs: wasm-build
34+
permissions:
35+
id-token: write
36+
steps:
37+
- uses: actions/checkout@v6
38+
- uses: actions/setup-node@v6
39+
with:
40+
node-version-file: ".node-version"
41+
registry-url: "https://registry.npmjs.org"
42+
- uses: actions/download-artifact@v7
43+
with:
44+
name: build
45+
path: pkg/
46+
- name: Publish
47+
working-directory: pkg
48+
run: npm publish --provenance
49+
50+
publish-jsr:
51+
if: startsWith(github.ref, 'refs/tags/v')
52+
runs-on: ubuntu-latest
53+
permissions:
54+
contents: read
55+
id-token: write
56+
needs: wasm-build
57+
steps:
58+
- uses: actions/checkout@v6
59+
- uses: actions/setup-node@v6
60+
with:
61+
node-version-file: ".node-version"
62+
- uses: actions/download-artifact@v7
63+
with:
64+
name: build
65+
path: pkg/
66+
- name: Publish
67+
working-directory: pkg
68+
run: npx jsr publish --allow-dirty
69+
70+
publish-github:
71+
if: startsWith(github.ref, 'refs/tags/v')
72+
runs-on: ubuntu-latest
73+
needs: wasm-build
74+
permissions:
75+
packages: write
76+
steps:
77+
- uses: actions/checkout@v6
78+
- uses: actions/setup-node@v6
79+
with:
80+
node-version-file: ".node-version"
81+
registry-url: "https://npm.pkg.github.com"
82+
- uses: actions/download-artifact@v7
83+
with:
84+
name: build
85+
path: pkg/
86+
- name: Publish
87+
working-directory: pkg
88+
run: npm publish
89+
env:
90+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
92+
publish-github-release:
93+
if: startsWith(github.ref, 'refs/tags/v')
94+
runs-on: ubuntu-latest
95+
needs: wasm-build
96+
permissions:
97+
contents: write
98+
steps:
99+
- uses: actions/checkout@v6
100+
- uses: actions/download-artifact@v7
101+
with:
102+
name: build
103+
path: pkg/
104+
- name: Package
105+
working-directory: pkg
106+
run: npm pack
107+
- name: Release
108+
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87
109+
with:
110+
files: |
111+
pkg/*.tgz
112+
pkg/*.wasm

0 commit comments

Comments
 (0)