|
1 | | -# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/ |
| 1 | +# This file was autogenerated by dist: https://axodotdev.github.io/cargo-dist |
2 | 2 | # |
3 | 3 | # Copyright 2022-2024, axodotdev |
4 | 4 | # SPDX-License-Identifier: MIT or Apache-2.0 |
|
47 | 47 | jobs: |
48 | 48 | # Run 'dist plan' (or host) to determine what tasks we need to do |
49 | 49 | plan: |
50 | | - runs-on: "ubuntu-20.04" |
| 50 | + runs-on: "ubuntu-22.04" |
51 | 51 | outputs: |
52 | 52 | val: ${{ steps.plan.outputs.manifest }} |
53 | 53 | tag: ${{ !github.event.pull_request && github.ref_name || '' }} |
54 | 54 | tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }} |
55 | 55 | publishing: ${{ !github.event.pull_request }} |
56 | 56 | env: |
57 | | - GH_TOKEN: ${{ secrets.GH_PAT }} |
| 57 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
58 | 58 | steps: |
59 | 59 | - uses: actions/checkout@v4 |
60 | 60 | with: |
| 61 | + persist-credentials: false |
61 | 62 | submodules: recursive |
62 | 63 | - name: Install dist |
63 | 64 | # we specify bash to get pipefail; it guards against the `curl` command |
64 | 65 | # failing. otherwise `sh` won't catch that `curl` returned non-0 |
65 | 66 | shell: bash |
66 | | - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh | sh" |
| 67 | + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.2/cargo-dist-installer.sh | sh" |
67 | 68 | - name: Cache dist |
68 | 69 | uses: actions/upload-artifact@v4 |
69 | 70 | with: |
@@ -109,14 +110,15 @@ jobs: |
109 | 110 | runs-on: ${{ matrix.runner }} |
110 | 111 | container: ${{ matrix.container && matrix.container.image || null }} |
111 | 112 | env: |
112 | | - GH_TOKEN: ${{ secrets.GH_PAT }} |
| 113 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
113 | 114 | BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json |
114 | 115 | steps: |
115 | 116 | - name: enable windows longpaths |
116 | 117 | run: | |
117 | 118 | git config --global core.longpaths true |
118 | 119 | - uses: actions/checkout@v4 |
119 | 120 | with: |
| 121 | + persist-credentials: false |
120 | 122 | submodules: recursive |
121 | 123 | - name: Install Rust non-interactively if not already installed |
122 | 124 | if: ${{ matrix.container }} |
@@ -168,13 +170,14 @@ jobs: |
168 | 170 | needs: |
169 | 171 | - plan |
170 | 172 | - build-local-artifacts |
171 | | - runs-on: "ubuntu-20.04" |
| 173 | + runs-on: "ubuntu-22.04" |
172 | 174 | env: |
173 | | - GH_TOKEN: ${{ secrets.GH_PAT }} |
| 175 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
174 | 176 | BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json |
175 | 177 | steps: |
176 | 178 | - uses: actions/checkout@v4 |
177 | 179 | with: |
| 180 | + persist-credentials: false |
178 | 181 | submodules: recursive |
179 | 182 | - name: Install cached dist |
180 | 183 | uses: actions/download-artifact@v4 |
@@ -214,16 +217,17 @@ jobs: |
214 | 217 | - plan |
215 | 218 | - build-local-artifacts |
216 | 219 | - build-global-artifacts |
217 | | - # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine) |
218 | | - if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }} |
| 220 | + # Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine) |
| 221 | + if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }} |
219 | 222 | env: |
220 | | - GH_TOKEN: ${{ secrets.GH_PAT }} |
221 | | - runs-on: "ubuntu-20.04" |
| 223 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 224 | + runs-on: "ubuntu-22.04" |
222 | 225 | outputs: |
223 | 226 | val: ${{ steps.host.outputs.manifest }} |
224 | 227 | steps: |
225 | 228 | - uses: actions/checkout@v4 |
226 | 229 | with: |
| 230 | + persist-credentials: false |
227 | 231 | submodules: recursive |
228 | 232 | - name: Install cached dist |
229 | 233 | uses: actions/download-artifact@v4 |
@@ -274,18 +278,48 @@ jobs: |
274 | 278 |
|
275 | 279 | gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* |
276 | 280 |
|
| 281 | + publish-npm: |
| 282 | + needs: |
| 283 | + - plan |
| 284 | + - host |
| 285 | + runs-on: "ubuntu-22.04" |
| 286 | + env: |
| 287 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 288 | + PLAN: ${{ needs.plan.outputs.val }} |
| 289 | + if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} |
| 290 | + steps: |
| 291 | + - name: Fetch npm packages |
| 292 | + uses: actions/download-artifact@v4 |
| 293 | + with: |
| 294 | + pattern: artifacts-* |
| 295 | + path: npm/ |
| 296 | + merge-multiple: true |
| 297 | + - uses: actions/setup-node@v4 |
| 298 | + with: |
| 299 | + node-version: '20.x' |
| 300 | + registry-url: 'https://registry.npmjs.org' |
| 301 | + - run: | |
| 302 | + for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do |
| 303 | + pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output) |
| 304 | + npm publish --access public "./npm/${pkg}" |
| 305 | + done |
| 306 | + env: |
| 307 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 308 | +
|
277 | 309 | announce: |
278 | 310 | needs: |
279 | 311 | - plan |
280 | 312 | - host |
| 313 | + - publish-npm |
281 | 314 | # use "always() && ..." to allow us to wait for all publish jobs while |
282 | 315 | # still allowing individual publish jobs to skip themselves (for prereleases). |
283 | 316 | # "host" however must run to completion, no skipping allowed! |
284 | | - if: ${{ always() && needs.host.result == 'success' }} |
285 | | - runs-on: "ubuntu-20.04" |
| 317 | + if: ${{ always() && needs.host.result == 'success' && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }} |
| 318 | + runs-on: "ubuntu-22.04" |
286 | 319 | env: |
287 | | - GH_TOKEN: ${{ secrets.GH_PAT }} |
| 320 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
288 | 321 | steps: |
289 | 322 | - uses: actions/checkout@v4 |
290 | 323 | with: |
| 324 | + persist-credentials: false |
291 | 325 | submodules: recursive |
0 commit comments