feat: produceMany [cd] #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| APP_NAME: hermesmq-node | |
| jobs: | |
| version: | |
| if: contains(github.event.head_commit.message, '[cd]') | |
| name: compute version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.bump.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 24 | |
| - name: Compute next version | |
| id: bump | |
| run: | | |
| npm version patch --no-git-tag-version > /dev/null | |
| VERSION="$(node -p "require('./package.json').version")" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| build: | |
| name: build ${{ matrix.settings.target }} | |
| needs: version | |
| runs-on: ${{ matrix.settings.host }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| # - host: windows-latest | |
| # target: x86_64-pc-windows-msvc | |
| # build: napi build --platform --release --target x86_64-pc-windows-msvc | |
| # - host: macos-latest | |
| # target: aarch64-apple-darwin | |
| # build: napi build --platform --release --target aarch64-apple-darwin | |
| # - host: macos-latest | |
| # target: x86_64-apple-darwin | |
| # build: napi build --platform --release --target x86_64-apple-darwin | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| build: napi build --platform --release --target x86_64-unknown-linux-gnu --cross-compile | |
| - host: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| build: napi build --platform --release --target aarch64-unknown-linux-gnu --cross-compile | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| build: napi build --platform --release --target x86_64-unknown-linux-musl --cross-compile | |
| - host: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| build: napi build --platform --release --target aarch64-unknown-linux-musl --cross-compile | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 24 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable | |
| with: | |
| targets: ${{ matrix.settings.target }} | |
| - name: Setup zig | |
| if: runner.os == 'Linux' | |
| uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1 | |
| with: | |
| version: 0.14.1 | |
| - name: Setup cargo-zigbuild | |
| if: runner.os == 'Linux' | |
| uses: taiki-e/install-action@59012be0884e296ca2da49b530610e72c49039ad # v2.81.6 | |
| with: | |
| tool: cargo-zigbuild | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build | |
| run: npx ${{ matrix.settings.build }} | |
| shell: bash | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: bindings-${{ matrix.settings.target }} | |
| path: ${{ env.APP_NAME }}.*.node | |
| if-no-files-found: error | |
| publish: | |
| name: publish to npm | |
| needs: [version, build] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: v24 | |
| registry-url: https://registry.npmjs.org | |
| - name: Set version | |
| run: npm version ${{ needs.version.outputs.version }} --no-git-tag-version --allow-same-version | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Download artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Assemble platform packages | |
| run: | | |
| npx napi create-npm-dirs | |
| npx napi artifacts | |
| ls -R npm | |
| - name: Publish | |
| run: | | |
| npx napi prepublish -t npm | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| commit: | |
| name: commit version bump | |
| needs: [version, publish] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 24 | |
| - name: Bump and push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| npm version ${{ needs.version.outputs.version }} --no-git-tag-version --allow-same-version | |
| sed -i -E "0,/^version = \".*\"/ s//version = \"${{ needs.version.outputs.version }}\"/" Cargo.toml | |
| git add package.json Cargo.toml | |
| git commit -m "release: v${{ needs.version.outputs.version }}" | |
| git push origin HEAD:${{ github.ref_name }} | |
| git tag -f "v${{ needs.version.outputs.version }}" | |
| git push --force origin "v${{ needs.version.outputs.version }}" |