feat: retry/ idempotency 0.2.0 #2
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: hyperiondb-client | |
| jobs: | |
| version: | |
| if: contains(github.event.head_commit.message, '[cd]') | |
| name: bump version | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| version: ${{ steps.bump.outputs.version }} | |
| sha: ${{ steps.bump.outputs.sha }} | |
| 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 | |
| id: bump | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| npm version patch --no-git-tag-version | |
| VERSION="$(node -p "require('./package.json').version")" | |
| sed -i -E "0,/^version = \".*\"/ s//version = \"$VERSION\"/" Cargo.toml | |
| git add package.json Cargo.toml | |
| git commit -m "release: v$VERSION" | |
| git push origin HEAD:${{ github.ref_name }} | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "sha=$(git rev-parse HEAD)" >> "$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 | |
| with: | |
| ref: ${{ needs.version.outputs.sha }} | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 22 | |
| - 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@53fc45b17fe98b52f92ee5ea08ff48a85a3e7eb7 # v1.2.2 | |
| - 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 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| ref: ${{ needs.version.outputs.sha }} | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: v24 | |
| registry-url: https://registry.npmjs.org | |
| - 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 }} |