Skip to content

Commit b62e925

Browse files
committed
eat: enable npm publish jobs
1 parent 75e1aa0 commit b62e925

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,43 @@ jobs:
278278
279279
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
280280
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+
281309
announce:
282310
needs:
283311
- plan
284312
- host
313+
- publish-npm
285314
# use "always() && ..." to allow us to wait for all publish jobs while
286315
# still allowing individual publish jobs to skip themselves (for prereleases).
287316
# "host" however must run to completion, no skipping allowed!
288-
if: ${{ always() && needs.host.result == 'success' }}
317+
if: ${{ always() && needs.host.result == 'success' && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }}
289318
runs-on: "ubuntu-22.04"
290319
env:
291320
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

dist-workspace.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ ci = "github"
1212
# The installers to generate for each app
1313
installers = ["shell", "powershell", "npm"]
1414
# Target platforms to build apps for (Rust target-triple syntax)
15-
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
15+
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
1616
# A namespace to use when publishing this package to the npm registry
1717
npm-scope = "@docbox-nz"
1818
# Path that installers should place binaries in
1919
install-path = "CARGO_HOME"
2020
# Whether to install an updater program
2121
install-updater = true
22+
# Publish jobs to run in CI
23+
publish-jobs = ["npm"]

0 commit comments

Comments
 (0)