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@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Set Rust
uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 with:
package_json_file: node/package.json
- name: Set Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e with:
node-version: "22"
cache: pnpm
cache-dependency-path: node/pnpm-lock.yaml
- name: Set Rust
uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 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@ea165f8d65b6e75b540449e92b4886f43607fa02 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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 with:
package_json_file: node/package.json
- name: Set Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e 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@d3f86a106a0bac45b974a628896c90dbdf5c8093 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