Improve CI workflows #9
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
name: Build NPM package | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "**" | |
pull_request: | |
branches: | |
- "**" | |
jobs: | |
build_npm: | |
name: NPM package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install wasm-pack | |
run: cargo install wasm-pack --locked | |
- name: Build wasm | |
run: | | |
cd wasm | |
wasm-pack build | |
wasm-pack pack | |
- name: Upload NPM package artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: npm-pkg | |
path: ./wasm/pkg/*-*.tgz | |
- name: Publish (npmjs.com) | |
if: startsWith(github.event.ref, 'refs/tags') | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.node_auth_token }} | |
package: wasm/pkg/package.json |