Skip to content

Commit 55d8aaf

Browse files
Merge pull request modelcontextprotocol#29 from modelcontextprotocol/justin/publish-packs
Automatically publish `npm pack` to GH Releases
2 parents f0ac5af + 8e07474 commit 55d8aaf

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

.github/workflows/main.yml

+30-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ on:
22
push:
33
branches:
44
- main
5-
65
pull_request:
6+
release:
7+
types: [created]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
712

813
jobs:
914
build:
@@ -18,9 +23,29 @@ jobs:
1823

1924
- run: npm ci
2025
- run: npm run build
21-
22-
- name: Verify that `npm run build` did not change outputs
23-
run: git diff --exit-code
24-
2526
- run: npm test
2627
- run: npm run lint
28+
29+
package:
30+
runs-on: ubuntu-latest
31+
if: github.event_name == 'release'
32+
needs: build
33+
34+
permissions:
35+
contents: write
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: 18
42+
cache: npm
43+
44+
- run: npm ci
45+
- run: npm pack
46+
47+
- name: Upload package to release
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: |
51+
gh release upload ${{ github.event.release.tag_name }} ./*.tgz

0 commit comments

Comments
 (0)