|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: {} |
| 9 | + |
| 10 | +env: |
| 11 | + DEBUG: 'napi:*' |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + name: Build - ${{ matrix.target }} |
| 20 | + permissions: |
| 21 | + contents: read |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - target: x86_64-unknown-linux-gnu |
| 28 | + os: ubuntu-latest |
| 29 | + - target: x86_64-unknown-linux-musl |
| 30 | + os: ubuntu-latest |
| 31 | + - target: aarch64-unknown-linux-gnu |
| 32 | + os: ubuntu-latest |
| 33 | + - target: aarch64-unknown-linux-musl |
| 34 | + os: ubuntu-latest |
| 35 | + - target: x86_64-apple-darwin |
| 36 | + os: macos-latest |
| 37 | + - target: aarch64-apple-darwin |
| 38 | + os: macos-latest |
| 39 | + - target: x86_64-pc-windows-msvc |
| 40 | + os: windows-latest |
| 41 | + - target: aarch64-pc-windows-msvc |
| 42 | + os: windows-latest |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Support longpaths |
| 46 | + if: ${{ matrix.os == 'windows-latest' }} |
| 47 | + run: git config --system core.longpaths true |
| 48 | + - uses: actions/checkout@v6 |
| 49 | + with: |
| 50 | + submodules: recursive |
| 51 | + |
| 52 | + - name: Install Rust |
| 53 | + uses: dtolnay/rust-toolchain@stable |
| 54 | + with: |
| 55 | + targets: ${{ matrix.target }} |
| 56 | + |
| 57 | + - name: Cache Rust |
| 58 | + uses: Swatinem/rust-cache@v2 |
| 59 | + |
| 60 | + - uses: mlugg/setup-zig@v2 |
| 61 | + if: ${{ contains(matrix.target, 'musl') }} |
| 62 | + with: |
| 63 | + version: 0.15.2 |
| 64 | + |
| 65 | + - name: Install cargo-zigbuild |
| 66 | + uses: taiki-e/install-action@v2 |
| 67 | + if: ${{ contains(matrix.target, 'musl') }} |
| 68 | + env: |
| 69 | + GITHUB_TOKEN: ${{ github.token }} |
| 70 | + with: |
| 71 | + tool: cargo-zigbuild |
| 72 | + |
| 73 | + - name: Install pnpm |
| 74 | + uses: pnpm/action-setup@v4 |
| 75 | + |
| 76 | + - name: Install Node.js |
| 77 | + uses: actions/setup-node@v6 |
| 78 | + with: |
| 79 | + node-version: 24 |
| 80 | + cache: pnpm |
| 81 | + |
| 82 | + - name: Install dependencies |
| 83 | + run: pnpm install |
| 84 | + |
| 85 | + - name: Build ${{ matrix.target }} |
| 86 | + working-directory: napi/angular-compiler |
| 87 | + if: ${{ !contains(matrix.target , 'gnu') && !contains(matrix.target, 'musl') }} |
| 88 | + run: pnpm build-dev -- --release --target ${{ matrix.target }} |
| 89 | + |
| 90 | + - name: Build ${{ matrix.target }} |
| 91 | + working-directory: napi/angular-compiler |
| 92 | + if: ${{ contains(matrix.target , 'gnu') }} |
| 93 | + run: pnpm build-dev -- --release --target ${{ matrix.target }} --use-napi-cross |
| 94 | + |
| 95 | + - name: Build ${{ matrix.target }} |
| 96 | + working-directory: napi/angular-compiler |
| 97 | + if: ${{ contains(matrix.target, 'musl') }} |
| 98 | + run: pnpm build-dev -- --release --target ${{ matrix.target }} -x |
| 99 | + |
| 100 | + - name: Upload artifact |
| 101 | + uses: actions/upload-artifact@v6 |
| 102 | + with: |
| 103 | + name: bindings-${{ matrix.target }} |
| 104 | + path: napi/angular-compiler/*.node |
| 105 | + if-no-files-found: error |
| 106 | + |
| 107 | + publish: |
| 108 | + name: Publish |
| 109 | + permissions: |
| 110 | + contents: write |
| 111 | + id-token: write |
| 112 | + packages: write |
| 113 | + runs-on: ubuntu-latest |
| 114 | + needs: build |
| 115 | + steps: |
| 116 | + - uses: actions/checkout@v6 |
| 117 | + |
| 118 | + - name: Install pnpm |
| 119 | + uses: pnpm/action-setup@v4 |
| 120 | + |
| 121 | + - name: Install Node.js |
| 122 | + uses: actions/setup-node@v6 |
| 123 | + with: |
| 124 | + node-version: 24 |
| 125 | + cache: pnpm |
| 126 | + |
| 127 | + - name: Install dependencies |
| 128 | + run: pnpm install |
| 129 | + |
| 130 | + - name: Download artifacts |
| 131 | + uses: actions/download-artifact@v7 |
| 132 | + with: |
| 133 | + path: napi/angular-compiler/artifacts |
| 134 | + |
| 135 | + - name: Create npm dirs |
| 136 | + run: pnpm --filter ./napi/angular-compiler exec napi create-npm-dirs |
| 137 | + |
| 138 | + - name: Move artifacts |
| 139 | + run: pnpm --filter ./napi/angular-compiler artifacts |
| 140 | + |
| 141 | + - name: Publish to npm |
| 142 | + working-directory: napi/angular-compiler |
| 143 | + run: | |
| 144 | + echo '@voidzero-dev:registry=https://npm.pkg.github.com/' >> ~/.npmrc |
| 145 | + npm install -g npm |
| 146 | + npm publish |
| 147 | + env: |
| 148 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments