|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*.*.*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + - host: macos-latest |
| 15 | + target: aarch64-apple-darwin |
| 16 | + - host: macos-latest |
| 17 | + target: x86_64-apple-darwin |
| 18 | + - host: ubuntu-latest |
| 19 | + target: x86_64-unknown-linux-gnu |
| 20 | + - host: windows-latest |
| 21 | + target: x86_64-pc-windows-msvc |
| 22 | + runs-on: ${{ matrix.host }} |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 |
| 25 | + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 |
| 26 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 27 | + with: |
| 28 | + node-version-file: .node-version |
| 29 | + cache: 'pnpm' |
| 30 | + - uses: dtolnay/rust-toolchain@stable |
| 31 | + with: |
| 32 | + targets: ${{ matrix.target }} |
| 33 | + - run: pnpm install |
| 34 | + - run: pnpm napi build --platform --release --esm --target ${{ matrix.target }} |
| 35 | + |
| 36 | + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 37 | + with: |
| 38 | + name: nodes-${{ matrix.host }}-${{ matrix.target }} |
| 39 | + path: | |
| 40 | + *.node |
| 41 | + if-no-files-found: error |
| 42 | + |
| 43 | + publish: |
| 44 | + needs: build |
| 45 | + runs-on: ubuntu-latest |
| 46 | + permissions: |
| 47 | + contents: read |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 |
| 50 | + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 |
| 51 | + with: |
| 52 | + pattern: nodes-* |
| 53 | + merge-multiple: true |
| 54 | + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 |
| 55 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 56 | + with: |
| 57 | + node-version-file: .node-version |
| 58 | + cache: 'pnpm' |
| 59 | + registry-url: https://registry.npmjs.org |
| 60 | + always-auth: true |
| 61 | + - run: pnpm install |
| 62 | + - run: pnpm napi create-npm-dirs |
| 63 | + - run: pnpm napi artifacts -o . |
| 64 | + - run: napi build --platform --release --esm |
| 65 | + - run: pnpm napi prepublish -t npm --gh-release |
| 66 | + |
| 67 | + - run: pnpm publish --access public |
| 68 | + env: |
| 69 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments