-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Publish Rust WASM package to npm (#5721)
Adds GitHub Actions workflow to build, test and publish the ironfish-rust-wasm package to npm. Includes Firefox and Chrome headless testing and supports dry-run mode for validation before actual publishing.
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Deploy NPM Ironfish Rust Wasm | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dry-run: | ||
description: 'Run the publish command in dry-run mode' | ||
required: false | ||
default: 'false' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
registry-url: 'https://registry.npmjs.org' | ||
cache: yarn | ||
|
||
- name: Cache Rust | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: wasm | ||
|
||
- name: Install wasm-pack | ||
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | ||
|
||
- name: Generate package | ||
working-directory: ./ironfish-rust-wasm | ||
run: wasm-pack build --release --target=web | ||
|
||
- name: Test in Firefox | ||
working-directory: ./ironfish-rust-wasm | ||
run: wasm-pack test --headless --firefox | ||
|
||
- name: Test in Chrome | ||
working-directory: ./ironfish-rust-wasm | ||
run: wasm-pack test --headless --chrome | ||
|
||
- name: Publish | ||
working-directory: ./ironfish-rust-wasm/pkg | ||
run: | | ||
if [ ${{ github.event.inputs.dry-run }} = "true" ]; then | ||
npm publish --access public --dry-run | ||
else | ||
npm publish --access public | ||
fi | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |