Skip to content

Commit

Permalink
Add tgz archive of wasm module to GitHub release
Browse files Browse the repository at this point in the history
  • Loading branch information
hansott committed Oct 4, 2024
1 parent 0c2e68f commit 37d3dc1
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,41 @@ jobs:
name: mac-binaries-arm64
path: target/aarch64-apple-darwin/release/libzen_internals_*

build-wasm:
needs:
- tests
- lint
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
override-file: rust-toolchain
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Build with wasm-pack
run: wasm-pack build --target nodejs
- run: |
cd pkg
tar -czvf zen_internals.tgz zen_internals.js zen_internals.d.ts zen_internals_bg.wasm
FILE=zen_internals.tgz
sudo touch ${FILE}.sha256sum && sudo chmod 777 ${FILE}.sha256sum
sudo sha256sum "${FILE}" | cut -d ' ' -f 1 > ${FILE}.sha256sum
- name: Store the .tgz file and the sha256sum file
uses: actions/upload-artifact@v3
with:
name: wasm-binaries
path: pkg/zen_internals.tgz*

create-github-release:
needs: [build-linux, build-linux-arm64, build-windows, build-mac, build-mac-arm64]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -345,3 +380,28 @@ jobs:
asset_content_type: text/plain
env:
GITHUB_TOKEN: ${{ github.token }}

# Add WASM binary and sha file to release :
- name: Download WASM binaries
uses: actions/download-artifact@v3
with:
name: wasm-binaries
path: ./artifacts/wasm
- name: Upload WASM binary to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/wasm/zen_internals.tgz
asset_name: zen_internals.tgz
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload WASM binary sha256sum
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/wasm/zen_internals.tgz.sha256sum
asset_name: zen_internals.tgz.sha256sum
asset_content_type: text/plain
env:
GITHUB_TOKEN: ${{ github.token }}

0 comments on commit 37d3dc1

Please sign in to comment.