File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Publish NPM Package
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+
8+ permissions :
9+ contents : read
10+ id-token : write
11+
12+ jobs :
13+ publish :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Checkout
17+ uses : actions/checkout@v4
18+
19+ - name : Setup Node.js
20+ uses : actions/setup-node@v4
21+ with :
22+ node-version : " 24.x"
23+ registry-url : " https://registry.npmjs.org"
24+
25+ - name : Setup pnpm
26+ uses : pnpm/action-setup@v4
27+ with :
28+ version : " 10"
29+
30+ - name : Ensure npm supports trusted publishing
31+ run : npm install -g npm@latest
32+
33+ - name : Check tag matches package version
34+ id : version
35+ run : |
36+ PKG_VERSION=$(node -p "require('./packages/yapi-mcp/package.json').version")
37+ if [ "v$PKG_VERSION" != "${GITHUB_REF_NAME}" ]; then
38+ echo "match=false" >> $GITHUB_OUTPUT
39+ echo "Skip publish: tag ${GITHUB_REF_NAME} does not match v${PKG_VERSION}."
40+ exit 0
41+ fi
42+ echo "match=true" >> $GITHUB_OUTPUT
43+
44+ - name : Install dependencies
45+ if : steps.version.outputs.match == 'true'
46+ run : pnpm -C packages/yapi-mcp install --frozen-lockfile
47+
48+ - name : Build package
49+ if : steps.version.outputs.match == 'true'
50+ run : pnpm -C packages/yapi-mcp build
51+
52+ - name : Publish to npm
53+ if : steps.version.outputs.match == 'true'
54+ working-directory : packages/yapi-mcp
55+ run : npm publish
You can’t perform that action at this time.
0 commit comments