File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ name: Release WASM
22
33on :
44 push :
5+ branches : ["master", "main"]
56 tags :
6- - ' 0.0.1'
7- - ' v* '
7+ - " 0.0.1"
8+ - " v* "
89
910permissions :
1011 contents : write
@@ -14,15 +15,33 @@ jobs:
1415 runs-on : ubuntu-latest
1516 steps :
1617 - uses : actions/checkout@v4
18+ - name : Install binaryen
19+ run : sudo apt-get update && sudo apt-get install -y binaryen
1720 - name : Build WASM
1821 run : |
1922 if [ -f Makefile ] && grep -q build_wasm Makefile; then
2023 make build_wasm || true
21- cp bin/cdd-python.wasm . || echo -n -e '\x00asm\x01\x00\x00\x00' > cdd-python.wasm
22- else
24+ cp bin/*.wasm . 2>/dev/null || cp build/*.wasm . 2>/dev/null || cp target/wasm32-wasip1/release/*.wasm . 2>/dev/null || true
25+ fi
26+ # Fallback to dummy if no wasm was found
27+ if ! ls *.wasm 1> /dev/null 2>&1; then
2328 echo -n -e '\x00asm\x01\x00\x00\x00' > cdd-python.wasm
2429 fi
30+ for f in *.wasm; do
31+ if [ -f "$f" ]; then
32+ wasm-opt -O3 "$f" -o "$f" || true
33+ fi
34+ done
35+ - name : Update latest tag
36+ if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
37+ run : |
38+ git config user.name "github-actions"
39+ git config user.email "github-actions@github.com"
40+ git tag -f latest
41+ git push origin -f latest
2542 - name : Release WASM Artifact
2643 uses : softprops/action-gh-release@v2
2744 with :
28- files : cdd-python.wasm
45+ tag_name : ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}
46+ files : " *.wasm"
47+ prerelease : ${{ !startsWith(github.ref, 'refs/tags/') }}
You can’t perform that action at this time.
0 commit comments