name: Release
on:
push:
branches: [main]
permissions:
contents: read
jobs:
release-please:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
steps:
- name: Run release-please
id: release
uses: googleapis/release-please-action@0dfd8538845b8e92600d271a895a5372865d4062 with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
token: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
publish-crate:
needs:
- release-please
- publish-npm
if: ${{ needs.release-please.outputs.releases_created == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Set Rust
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c with:
toolchain: stable
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
build-native:
needs: release-please
if: ${{ needs.release-please.outputs.releases_created == 'true' }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rust-target: x86_64-unknown-linux-gnu
artifact: linux-x64-gnu
- os: ubuntu-24.04-arm
rust-target: aarch64-unknown-linux-gnu
artifact: linux-arm64-gnu
- os: macos-latest
rust-target: aarch64-apple-darwin
artifact: darwin-arm64
- os: macos-15-intel
rust-target: x86_64-apple-darwin
artifact: darwin-x64
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
artifact: win32-x64-msvc
- os: windows-11-arm
rust-target: aarch64-pc-windows-msvc
artifact: win32-arm64-msvc
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: node
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 with:
package_json_file: node/package.json
- name: Set Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 with:
node-version: "22"
cache: pnpm
cache-dependency-path: node/pnpm-lock.yaml
- name: Set Rust
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c with:
toolchain: stable
targets: ${{ matrix.rust-target }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build native addon
run: pnpm build:native
env:
FERROMARK_RUST_TARGET: ${{ matrix.rust-target }}
- name: Test native package
run: pnpm test
- name: Upload native binary
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with:
name: native-${{ matrix.artifact }}
path: node/ferromark/ferromark.${{ matrix.artifact }}.node
if-no-files-found: error
retention-days: 1
publish-npm:
needs:
- release-please
- build-native
if: ${{ needs.release-please.outputs.releases_created == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: node
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 with:
package_json_file: node/package.json
- name: Set Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 with:
node-version: "24"
registry-url: https://registry.npmjs.org
cache: pnpm
cache-dependency-path: node/pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Audit dependencies
run: pnpm audit --audit-level high
- name: Download native binaries
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with:
pattern: native-*
merge-multiple: true
path: node/ferromark
- name: Verify release package
run: node ./scripts/verify-release.mjs
- name: Test packed package
run: |
pnpm test
pnpm typecheck
pnpm lint
node ./scripts/verify-pack.mjs --all-targets
pnpm smoke:clean
- name: Publish to npm with trusted publishing
working-directory: node/ferromark
run: npm publish --access public --provenance