on: push: tags: ["@duper-js/node@*.*.*"] permissions: contents: read env: RUST_VERSION: "1.94.0" CARGO_INCREMENTAL: "0" CARGO_PROFILE_TEST_DEBUG: "0" NODE_VERSION: "22" jobs: build: strategy: fail-fast: false matrix: include: - runner: ubuntu-24.04 target: x86_64-unknown-linux-gnu os: linux - runner: ubuntu-24.04 target: aarch64-unknown-linux-gnu os: linux - runner: ubuntu-24.04 target: x86_64-unknown-linux-musl os: linux - runner: ubuntu-24.04 target: aarch64-unknown-linux-musl os: linux - runner: windows-latest target: x86_64-pc-windows-msvc os: windows - runner: windows-latest target: aarch64-pc-windows-msvc os: windows - runner: macos-15 target: x86_64-apple-darwin os: macos - runner: macos-15 target: aarch64-apple-darwin os: macos name: Build and package (${{ matrix.target }}) runs-on: ${{ matrix.runner }} steps: - name: Checkout repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: persist-credentials: true - name: Fetch MSRV and add target run: | rustup toolchain install ${RUST_VERSION} rustup override set ${RUST_VERSION} rustup target add ${{ matrix.target }} - name: Cache Rust dependencies uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 - name: Install Zig if: matrix.runner == 'ubuntu-24.04' uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5 with: version: latest - name: Install cargo-zigbuild (Linux) if: matrix.runner == 'ubuntu-24.04' uses: taiki-e/install-action@a24ba45235ed716ff76646268742990dc9458860 # v2.62.42 with: tool: cargo-zigbuild - name: Install lld (macOS) if: matrix.os == 'macos' run: | brew install lld - name: Install lld (Windows) if: matrix.os == 'windows' run: | choco install llvm - name: Setup Node uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version: ${{ env.NODE_VERSION }} - name: Install dependencies working-directory: duper-js-node run: | npm ci - name: Build with cargo-zigbuild (Linux) if: matrix.runner == 'ubuntu-24.04' working-directory: duper-js-node run: | npm run build:release -- --cross-compile --target ${{ matrix.target }} - name: Build with cargo (macOS / Windows) if: matrix.runner != 'ubuntu-24.04' working-directory: duper-js-node run: | npm run build:release -- --target ${{ matrix.target }} - name: Bundle working-directory: duper-js-node run: | npm run bundle - name: Upload artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: dist-${{ matrix.target }} path: duper-js-node/dist release: name: Release @duper-js/node runs-on: ubuntu-24.04 needs: build permissions: id-token: write steps: - name: Checkout repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: persist-credentials: true - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-x86_64-unknown-linux-gnu path: duper-js-node/dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-aarch64-unknown-linux-gnu path: duper-js-node/dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-x86_64-unknown-linux-musl path: duper-js-node/dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-aarch64-unknown-linux-musl path: duper-js-node/dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-x86_64-pc-windows-msvc path: duper-js-node/dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-aarch64-pc-windows-msvc path: duper-js-node/dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-x86_64-apple-darwin path: duper-js-node/dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-aarch64-apple-darwin path: duper-js-node/dist - run: | ls -al ./duper-js-node/dist - name: Setup Node uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version: ${{ env.NODE_VERSION }} registry-url: "https://registry.npmjs.org" - name: Update NPM run: npm install npm@11 -g - name: Publish to NPM working-directory: duper-js-node run: | npm publish --provenance --access public