|
10 | 10 |
|
11 | 11 | permissions: |
12 | 12 | contents: write |
| 13 | + id-token: write |
13 | 14 |
|
14 | 15 | jobs: |
| 16 | + publish-crates: |
| 17 | + name: Publish Rust crates |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - uses: dtolnay/rust-toolchain@stable |
| 23 | + |
| 24 | + - uses: Swatinem/rust-cache@v2 |
| 25 | + |
| 26 | + - name: Publish srcmap-codec |
| 27 | + run: cargo publish -p srcmap-codec || echo "Already published, skipping" |
| 28 | + env: |
| 29 | + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
| 30 | + |
| 31 | + - name: Wait for crates.io index |
| 32 | + run: sleep 30 |
| 33 | + |
| 34 | + - name: Publish srcmap-sourcemap |
| 35 | + run: cargo publish -p srcmap-sourcemap || echo "Already published, skipping" |
| 36 | + env: |
| 37 | + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
| 38 | + |
| 39 | + - name: Publish srcmap-generator |
| 40 | + run: cargo publish -p srcmap-generator || echo "Already published, skipping" |
| 41 | + env: |
| 42 | + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
| 43 | + |
| 44 | + - name: Wait for crates.io index |
| 45 | + run: sleep 30 |
| 46 | + |
| 47 | + - name: Publish srcmap-remapping |
| 48 | + run: cargo publish -p srcmap-remapping || echo "Already published, skipping" |
| 49 | + env: |
| 50 | + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
| 51 | + |
15 | 52 | build-napi: |
16 | 53 | name: Build NAPI - ${{ matrix.settings.target }} |
17 | 54 | runs-on: ${{ matrix.settings.host }} |
@@ -128,10 +165,89 @@ jobs: |
128 | 165 | path: packages/sourcemap-wasm/pkg/ |
129 | 166 | if-no-files-found: error |
130 | 167 |
|
| 168 | + publish-npm: |
| 169 | + name: Publish npm packages |
| 170 | + runs-on: ubuntu-latest |
| 171 | + needs: [build-napi, build-wasm] |
| 172 | + steps: |
| 173 | + - uses: actions/checkout@v4 |
| 174 | + |
| 175 | + - uses: actions/setup-node@v4 |
| 176 | + with: |
| 177 | + node-version: 20 |
| 178 | + registry-url: https://registry.npmjs.org |
| 179 | + |
| 180 | + - name: Install @napi-rs/cli |
| 181 | + run: npm install -g @napi-rs/cli |
| 182 | + |
| 183 | + - name: Download all codec NAPI artifacts |
| 184 | + uses: actions/download-artifact@v4 |
| 185 | + with: |
| 186 | + path: packages/codec/artifacts |
| 187 | + pattern: codec-bindings-* |
| 188 | + merge-multiple: false |
| 189 | + |
| 190 | + - name: Download all sourcemap NAPI artifacts |
| 191 | + uses: actions/download-artifact@v4 |
| 192 | + with: |
| 193 | + path: packages/sourcemap/artifacts |
| 194 | + pattern: sourcemap-bindings-* |
| 195 | + merge-multiple: false |
| 196 | + |
| 197 | + - name: Download WASM artifact |
| 198 | + uses: actions/download-artifact@v4 |
| 199 | + with: |
| 200 | + name: wasm-package |
| 201 | + path: packages/sourcemap-wasm/pkg |
| 202 | + |
| 203 | + - name: Move codec artifacts |
| 204 | + run: napi artifacts -d artifacts |
| 205 | + working-directory: packages/codec |
| 206 | + |
| 207 | + - name: Move sourcemap artifacts |
| 208 | + run: napi artifacts -d artifacts |
| 209 | + working-directory: packages/sourcemap |
| 210 | + |
| 211 | + - name: Publish @srcmap/codec platform packages |
| 212 | + run: | |
| 213 | + for dir in npm/*/; do |
| 214 | + npm publish "$dir" --access public --provenance || echo "Skipping $(basename "$dir")" |
| 215 | + done |
| 216 | + working-directory: packages/codec |
| 217 | + env: |
| 218 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 219 | + |
| 220 | + - name: Publish @srcmap/codec |
| 221 | + run: npm publish --access public --provenance --ignore-scripts |
| 222 | + working-directory: packages/codec |
| 223 | + env: |
| 224 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 225 | + |
| 226 | + - name: Publish @srcmap/sourcemap platform packages |
| 227 | + run: | |
| 228 | + for dir in npm/*/; do |
| 229 | + npm publish "$dir" --access public --provenance || echo "Skipping $(basename "$dir")" |
| 230 | + done |
| 231 | + working-directory: packages/sourcemap |
| 232 | + env: |
| 233 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 234 | + |
| 235 | + - name: Publish @srcmap/sourcemap |
| 236 | + run: npm publish --access public --provenance --ignore-scripts |
| 237 | + working-directory: packages/sourcemap |
| 238 | + env: |
| 239 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 240 | + |
| 241 | + - name: Publish @srcmap/sourcemap-wasm |
| 242 | + run: npm publish --access public --provenance --ignore-scripts |
| 243 | + working-directory: packages/sourcemap-wasm |
| 244 | + env: |
| 245 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 246 | + |
131 | 247 | create-release: |
132 | 248 | name: Create GitHub Release |
133 | 249 | runs-on: ubuntu-latest |
134 | | - needs: [build-napi, build-wasm] |
| 250 | + needs: [publish-crates, publish-npm] |
135 | 251 | steps: |
136 | 252 | - uses: actions/checkout@v4 |
137 | 253 |
|
|
0 commit comments