diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d9d841d..7d9cbe7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,6 +57,14 @@ jobs: - host: ubuntu-latest target: aarch64-unknown-linux-gnu build: npm run build -- --target aarch64-unknown-linux-gnu --use-napi-cross + # Linux musl (Alpine and other musl-based images). napi-rs uses + # cargo-zigbuild under the hood; `-x` tells `napi build` to drive it. + - host: ubuntu-latest + target: x86_64-unknown-linux-musl + build: npm run build -- --target x86_64-unknown-linux-musl -x + - host: ubuntu-latest + target: aarch64-unknown-linux-musl + build: npm run build -- --target aarch64-unknown-linux-musl -x # Windows - host: windows-latest target: x86_64-pc-windows-msvc @@ -93,6 +101,22 @@ jobs: target/ key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} + # musl builds go through cargo-zigbuild (napi-rs's `-x` flag). Zig + # supplies the cross-libc; cargo-zigbuild wires it into rustc. + - name: Setup Zig (musl targets only) + if: contains(matrix.settings.target, 'musl') + uses: mlugg/setup-zig@v2 + with: + version: 0.14.1 + + - name: Install cargo-zigbuild (musl targets only) + if: contains(matrix.settings.target, 'musl') + uses: taiki-e/install-action@v2 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tool: cargo-zigbuild + - name: Install Dependencies run: npm ci @@ -166,11 +190,16 @@ jobs: run: npm config set provenance true - name: Publish per-platform packages and update optionalDependencies - # All seven per-platform packages now have npm trusted publishing - # configured, so OIDC alone authenticates and NODE_AUTH_TOKEN is - # cleared to avoid setup-node's default GITHUB_TOKEN leaking - # in and breaking the provenance flow. - run: NODE_AUTH_TOKEN="" npx napi prepublish -t npm --no-gh-release + # Two new per-platform packages (config-disassembler-linux-x64-musl, + # config-disassembler-linux-arm64-musl) are net-new on npm and have + # no trusted-publisher configured yet (npm requires the package to + # exist before trusted publishing can be set up). Bootstrap via + # NPM_TOKEN for this release; once the two musl packages exist and + # trusted publishing is configured for them on npmjs.com, this can + # revert to `NODE_AUTH_TOKEN=""` to match the main publish below. + run: npx napi prepublish -t npm --no-gh-release + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Publish main package # Same trusted-publishing pattern as the per-platform packages diff --git a/README.md b/README.md index c30e281..3166509 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,12 @@ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/mcarvin8/config-disassembler-node/main/LICENSE.md) [![Downloads/week](https://img.shields.io/npm/dw/config-disassembler.svg)](https://npmjs.org/package/config-disassembler) -Node.js bindings for the Rust [`config-disassembler`](https://crates.io/crates/config-disassembler) crate via [napi-rs](https://napi.rs). +Node.js bindings for the Rust [`config-disassembler`](https://crates.io/crates/config-disassembler) crate. Disassemble configuration files (XML, JSON, JSON5, JSONC, YAML, TOON, TOML, INI) into smaller, version-control–friendly pieces — and reassemble them on demand. +> **Native Rust:** All work is done in [`config-disassembler`](https://crates.io/crates/config-disassembler); this package provides Node.js bindings via [napi-rs](https://napi.rs). + --- ## Table of contents @@ -373,11 +375,13 @@ Prebuilt native binaries are published as platform-scoped optional dependencies This package ships with native binaries for these platforms and architectures: -| Platform | Architectures | -| ----------- | ---------------------------------- | -| **macOS** | x64 (Intel), arm64 (Apple Silicon) | -| **Linux** | x64 (gnu), arm64 (gnu) | -| **Windows** | x64, arm64, ia32 | +| Platform | Architectures | +| ----------- | ---------------------------------------------------------- | +| **macOS** | x64 (Intel), arm64 (Apple Silicon) | +| **Linux** | x64 (gnu + musl), arm64 (gnu + musl) | +| **Windows** | x64, arm64, ia32 | + +The Linux musl builds (`config-disassembler-linux-x64-musl`, `config-disassembler-linux-arm64-musl`) cover Alpine-based images and other musl libc distributions commonly used for slim CI containers. Adding a new target is as simple as appending its Rust triple to the `napi.targets` array in `package.json` and adding the matching entry to the build matrix in `.github/workflows/release.yml`. If other platforms or architectures require support, please open an [issue](https://github.com/mcarvin8/config-disassembler-node/issues). diff --git a/package.json b/package.json index d1a8a62..d4a5b86 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,8 @@ "aarch64-apple-darwin", "x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", + "aarch64-unknown-linux-musl", "x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc", "i686-pc-windows-msvc"