add wasm-bindgen-cli #40
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: CI | |
on: | |
push: | |
branches: ['main'] | |
tags: | |
- "v*" | |
pull_request: | |
branches: ['main'] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to release (e.g., v1.2.3)' | |
required: false | |
default: '' | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.tag || github.ref }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- run: | | |
rustup target add wasm32-unknown-unknown | |
cargo install wasm-bindgen-cli | |
make test | |
release: | |
if: ${{ github.event.inputs.tag != '' || startsWith(github.ref, 'refs/tags/v') }} | |
runs-on: ubuntu-24.04 | |
needs: ['test'] | |
permissions: | |
contents: write | |
id-token: write # The OIDC ID token is used for authentication with JSR. | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.tag || github.ref }} | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
# we'll need this for both 'zig build' and 'cargo zigbuild' | |
- uses: mlugg/setup-zig@v1 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- run: cargo install cargo-zigbuild wasm-bindgen-cli | |
# https://github.com/rust-cross/cargo-zigbuild/issues/18#issuecomment-1076428026 | |
- name: macOS - Test build with SDKROOT | |
run: | | |
curl -sqL https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz | tar -Jx -C /tmp | |
- | |
name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
# either 'goreleaser' (default) or 'goreleaser-pro' | |
distribution: goreleaser | |
# 'latest', 'nightly', or a semver | |
version: '~> v2' | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SDKROOT: /tmp/MacOSX11.3.sdk | |
- working-directory: ./js | |
run: | | |
make build | |
npx jsr publish --allow-slow-types | |
# Why NPM...?? | |
rm **/.gitignore | |
npm publish --provenance --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |