Skip to content

Commit adfcf9c

Browse files
committed
chore: publish to npm
1 parent 9030cbb commit adfcf9c

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,44 @@ jobs:
322322
done
323323
git push
324324
325+
publish-npm:
326+
needs:
327+
- plan
328+
- host
329+
runs-on: "ubuntu-22.04"
330+
env:
331+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
332+
PLAN: ${{ needs.plan.outputs.val }}
333+
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
334+
steps:
335+
- name: Fetch npm packages
336+
uses: actions/download-artifact@v4
337+
with:
338+
pattern: artifacts-*
339+
path: npm/
340+
merge-multiple: true
341+
- uses: actions/setup-node@v4
342+
with:
343+
node-version: '20.x'
344+
registry-url: 'https://registry.npmjs.org'
345+
- run: |
346+
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do
347+
pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output)
348+
npm publish --access public "./npm/${pkg}"
349+
done
350+
env:
351+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
352+
325353
announce:
326354
needs:
327355
- plan
328356
- host
329357
- publish-homebrew-formula
358+
- publish-npm
330359
# use "always() && ..." to allow us to wait for all publish jobs while
331360
# still allowing individual publish jobs to skip themselves (for prereleases).
332361
# "host" however must run to completion, no skipping allowed!
333-
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }}
362+
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }}
334363
runs-on: "ubuntu-22.04"
335364
env:
336365
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

dist-workspace.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ create-release = false
2222
# A GitHub repo to push Homebrew formulas to
2323
tap = "rust-mcp-stack/homebrew-tap"
2424
# Publish jobs to run in CI
25-
publish-jobs = ["homebrew","npm"]
25+
publish-jobs = ["homebrew", "npm"]
2626
# A namespace to use when publishing this package to the npm registry
2727
npm-scope = "@rustmcp"
2828

0 commit comments

Comments
 (0)