Skip to content

Commit 09ddf75

Browse files
committed
ci: restructure npm publish workflow for better artifact handling
1 parent f65c06c commit 09ddf75

1 file changed

Lines changed: 38 additions & 9 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ on:
44
release:
55
types: [created]
66

7+
permissions:
8+
id-token: write
9+
contents: read
10+
711
jobs:
812
build:
913
if: github.repository == 'my-mcp-hub/mcp-kit'
1014
runs-on: ubuntu-latest
11-
permissions:
12-
contents: read
13-
id-token: write
1415
steps:
1516
- name: Get package name
1617
id: package
@@ -36,9 +37,37 @@ jobs:
3637
- name: Test Package
3738
run: pnpm run test
3839

39-
- name: Publish NPM Package
40-
run: |
41-
cd packages/$PACKAGE_NAME
42-
pnpm publish --no-git-checks --provenance --access public
43-
env:
44-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
- name: Pack package
41+
run: pnpm -C packages/${{ env.PACKAGE_NAME }} pack
42+
43+
- name: Upload dist artifact
44+
uses: actions/upload-artifact@v6
45+
with:
46+
name: npm-package
47+
path: packages/${{ env.PACKAGE_NAME }}/*.tgz
48+
49+
# - name: Publish NPM Package
50+
# run: |
51+
# cd packages/$PACKAGE_NAME
52+
# pnpm publish --no-git-checks --provenance --access public
53+
# env:
54+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55+
56+
publish:
57+
if: github.repository == 'my-mcp-hub/mcp-kit'
58+
needs: build
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- uses: actions/checkout@v6
63+
64+
- uses: actions/download-artifact@v7
65+
with:
66+
name: npm-package
67+
path: .
68+
69+
- uses: actions/setup-node@v6
70+
with:
71+
node-version: '24'
72+
registry-url: 'https://registry.npmjs.org'
73+
- run: npm publish *.tgz --no-git-checks --provenance --access public

0 commit comments

Comments
 (0)