fix: hotfix for node publish #4
Workflow file for this run
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: Publish Node SDK | |
| on: | |
| push: | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: "Publish target" | |
| required: true | |
| type: choice | |
| options: | |
| - npm | |
| - dry-run | |
| default: dry-run | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Install dependencies | |
| working-directory: packages/auths-node | |
| run: pnpm install | |
| - name: Install cross-compilation tools (Linux ARM64) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| - name: Build native module | |
| working-directory: packages/auths-node | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.target == 'aarch64-unknown-linux-gnu' && 'aarch64-linux-gnu-gcc' || '' }} | |
| run: pnpm build -- --target ${{ matrix.target }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: bindings-${{ matrix.target }} | |
| path: packages/auths-node/auths.*.node | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| needs: [build] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| artifact: bindings-x86_64-unknown-linux-gnu | |
| - os: macos-14 | |
| artifact: bindings-aarch64-apple-darwin | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Install dependencies | |
| working-directory: packages/auths-node | |
| run: pnpm install | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: packages/auths-node | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "CI" | |
| git config --global user.email "ci@auths.dev" | |
| - name: Run tests | |
| working-directory: packages/auths-node | |
| run: pnpm test | |
| publish: | |
| name: Publish to npm | |
| needs: [build, test] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'npm') | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Install dependencies | |
| working-directory: packages/auths-node | |
| run: pnpm install | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: packages/auths-node/artifacts | |
| merge-multiple: true | |
| - name: Move artifacts | |
| working-directory: packages/auths-node | |
| run: pnpm artifacts | |
| - name: Prepare npm packages | |
| working-directory: packages/auths-node | |
| run: pnpm prepublishOnly | |
| - name: Publish | |
| working-directory: packages/auths-node | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.target }}" = "dry-run" ]; then | |
| echo "Dry run - skipping publish" | |
| npm pack | |
| else | |
| npm publish --provenance --access public | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |