Skip to content

Commit e783455

Browse files
author
xychen
committed
Set up workflow for publishing to NPM
1 parent cd47b44 commit e783455

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,39 +68,33 @@ jobs:
6868
name: schema
6969
path: commands.schema.json
7070

71-
pack-npm:
71+
publish-npm:
72+
if: github.event_name == 'release'
7273
runs-on: ubuntu-latest
7374
needs: build
7475
steps:
7576
- name: Checkout
7677
uses: actions/checkout@v4
7778

78-
- name: Set up Node.js
79-
uses: actions/setup-node@v4
80-
with:
81-
node-version: '22'
82-
8379
- name: Download artifact
8480
uses: actions/download-artifact@v4
8581
with:
8682
pattern: commands-mcp_*
8783

88-
- name: Pack
89-
id: pack
84+
- name: Gather binaries
9085
run: |
9186
for dir in commands-mcp_*; do
9287
platform=${dir#commands-mcp_}
9388
mkdir -p binaries/${platform}
9489
mv -v ${dir}/commands-mcp* binaries/${platform}/
9590
chmod +x binaries/${platform}/commands-mcp*
9691
done
97-
echo "tarball=$(npm pack)" >> "$GITHUB_OUTPUT"
9892
99-
- name: Archive tarball
100-
uses: actions/upload-artifact@v4
93+
- name: Publish to NPM
94+
uses: JS-DevTools/npm-publish@v3
10195
with:
102-
name: npm-tarball
103-
path: ${{ steps.pack.outputs.tarball }}
96+
token: ${{ secrets.NPM_TOKEN }}
97+
access: public
10498

10599
pack-dxt:
106100
runs-on: ubuntu-latest
@@ -119,14 +113,17 @@ jobs:
119113
with:
120114
pattern: commands-mcp_*
121115

122-
- name: Pack DXT
116+
- name: Gather binaries
123117
run: |
124118
for dir in commands-mcp_*; do
125119
platform=${dir#commands-mcp_}
126120
mkdir -p binaries/${platform}
127121
mv -v ${dir}/commands-mcp* binaries/${platform}/
128122
chmod +x binaries/${platform}/commands-mcp*
129123
done
124+
125+
- name: Pack DXT
126+
run: |
130127
mkdir -p dxt
131128
mv -v binaries manifest.json npm-wrapper.mjs dxt/
132129
npx -y @anthropic-ai/dxt pack dxt commands-mcp.dxt

0 commit comments

Comments
 (0)