Skip to content

Commit

Permalink
ci: Publish Rust WASM package to npm (#5721)
Browse files Browse the repository at this point in the history
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
patnir authored Feb 6, 2025
1 parent 76d47a5 commit a88b156
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/deploy-npm-ironfish-rust-wasm.yml
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 }}

0 comments on commit a88b156

Please sign in to comment.