Skip to content

release: v0.1.1

release: v0.1.1 #8

Workflow file for this run

name: Release
env:
DEBUG: napi:*
APP_NAME: rust-postprocessor
MACOSX_DEPLOYMENT_TARGET: "10.13"
permissions:
contents: read
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
- host: macos-latest
target: aarch64-apple-darwin
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
- host: windows-latest
target: aarch64-pc-windows-msvc
- host: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
setup: |
sudo apt-get update
sudo apt-get install gcc-riscv64-linux-gnu -y
name: stable - ${{ matrix.settings.target }} - node@22
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Setup node
uses: actions/setup-node@v7
if: ${{ !matrix.settings.docker }}
with:
node-version: 22
cache: npm
- name: Install
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
with:
toolchain: nightly-2025-09-30
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Install dependencies
if: ${{ !matrix.settings.docker }}
run: npm ci
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: "--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build"
run: |
# Upgrade Node.js to 22 (napi-rs images ship Node 18, @napi-rs/cli requires >= 20)
if command -v apk > /dev/null 2>&1; then
apk add --no-cache xz
wget -qO- https://unofficial-builds.nodejs.org/download/release/v22.14.0/node-v22.14.0-linux-x64-musl.tar.xz | tar -xJ -C /usr/local --strip-components=1
else
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs
fi
rustup toolchain install nightly-2025-09-30
rustup default nightly-2025-09-30
rustup target add ${{ matrix.settings.target }}
if [ "${{ matrix.settings.target }}" = "aarch64-unknown-linux-musl" ]; then
apk add --no-cache zig
fi
npm ci
npm run build -- --target ${{ matrix.settings.target }}
- name: Build
run: npm run build -- --target ${{ matrix.settings.target }}
if: ${{ !matrix.settings.docker }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: bindings-${{ matrix.settings.target }}
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
build-freebsd:
runs-on: ubuntu-latest
name: Build FreeBSD
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Build
id: build
uses: cross-platform-actions/action@v1.4.0
env:
DEBUG: napi:*
RUSTUP_IO_THREADS: 1
with:
operating_system: freebsd
version: "14.0"
memory: 8G
cpu_count: 3
environment_variables: DEBUG RUSTUP_IO_THREADS
shell: bash
run: |
sudo pkg install -y -f curl node libnghttp2 npm
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain nightly-2025-09-30
source "$HOME/.cargo/env"
echo "~~~~ rustc --version ~~~~"
rustc --version
echo "~~~~ node -v ~~~~"
node -v
echo "~~~~ npm --version ~~~~"
npm --version
pwd
ls -lah
whoami
env
freebsd-version
npm ci
npm run build
rm -rf node_modules
rm -rf target
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: bindings-freebsd
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
publish:
name: Publish
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: read
needs:
- build
- build-freebsd
steps:
- uses: actions/checkout@v7
- name: Setup node
uses: actions/setup-node@v7
with:
node-version: 22
registry-url: "https://registry.npmjs.org"
cache: npm
- name: Install dependencies
run: npm ci
- name: Verify tag matches package.json version
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG="${GITHUB_REF_NAME#v}"
PKG="$(node -p "require('./package.json').version")"
echo "tag=$TAG package.json=$PKG"
if [ "$TAG" != "$PKG" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match package.json version $PKG"
exit 1
fi
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Move artifacts
run: npm run artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Publish
run: |
# Upgrade npm for OIDC trusted publishing (requires npm >= 11.5.1)
npm install -g npm@11.18.0
# Update versions across platform packages (skip auto-publishing them)
npx napi prepublish --no-gh-release --skip-optional-publish
# Publish platform packages (skip packages without artifacts, stuck at 0.0.0)
for pkg_dir in npm/*/; do
if [ -d "$pkg_dir" ]; then
pkg_version=$(node -p "require('./${pkg_dir}package.json').version")
if [ "$pkg_version" = "0.0.0" ]; then
echo "Skipping ${pkg_dir} (no artifact, version 0.0.0)"
continue
fi
(cd "$pkg_dir" && npm publish --provenance --access public)
fi
done
# Publish main package (prepublish already ran above)
npm publish --provenance --access public --ignore-scripts