Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.

Commit 513c4d0

Browse files
mcp-tool-shopclaude
andcommitted
feat(ci): add release.yml — tag-push triggers npm publish + GH release
Adopts the rig-bridge release-spine pattern: - Fires on v* tag push - Tag-vs-package.json version match gate - npm ci -> audit (critical) -> build -> test -> built-CLI version smoke - npm publish --provenance --access public (uses NPM_TOKEN secret + id-token: write) - gh release create with --generate-notes and --verify-tag Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fada1d7 commit 513c4d0

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release
2+
3+
# Fires on git tags shaped like v1.0.0, v1.0.1, v1.1.0, etc.
4+
# - Builds + verifies (tests).
5+
# - Publishes to npm with --provenance (uses NPM_TOKEN secret).
6+
# - Creates a GitHub Release with auto-generated notes.
7+
8+
on:
9+
push:
10+
tags:
11+
- 'v[0-9]+.[0-9]+.[0-9]+'
12+
- 'v[0-9]+.[0-9]+.[0-9]+-*' # pre-release tags (e.g. v1.0.0-rc.1)
13+
14+
permissions:
15+
contents: write # needed to create the GitHub Release
16+
id-token: write # needed for npm --provenance attestation
17+
18+
jobs:
19+
release:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v6
24+
with:
25+
fetch-depth: 0 # fetch tags + history so gh release notes can compute since-last-tag
26+
27+
- name: Set up Node
28+
uses: actions/setup-node@v6
29+
with:
30+
node-version: "20"
31+
registry-url: "https://registry.npmjs.org"
32+
33+
- name: Verify tag matches package.json version
34+
run: |
35+
TAG="${GITHUB_REF_NAME#v}"
36+
PKG_VERSION=$(node -p "require('./package.json').version")
37+
if [ "$TAG" != "$PKG_VERSION" ]; then
38+
echo "::error::Tag $GITHUB_REF_NAME does not match package.json version $PKG_VERSION"
39+
exit 1
40+
fi
41+
echo "Tag and package.json version match: $PKG_VERSION"
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Audit dependencies
47+
run: npm audit --audit-level=critical
48+
49+
- name: Build
50+
run: npm run build
51+
52+
- name: Test
53+
run: npm test
54+
55+
- name: Built-CLI smoke
56+
run: |
57+
BUILT_VERSION=$(node dist/cli.js --version)
58+
PKG_VERSION=$(node -p "require('./package.json').version")
59+
if [ "$BUILT_VERSION" != "$PKG_VERSION" ]; then
60+
echo "::error::Built CLI version $BUILT_VERSION does not match package.json $PKG_VERSION"
61+
exit 1
62+
fi
63+
echo "CLI version smoke: $BUILT_VERSION"
64+
65+
- name: Publish to npm (with provenance)
66+
run: npm publish --provenance --access public
67+
env:
68+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
69+
70+
- name: Create GitHub Release
71+
env:
72+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
run: |
74+
gh release create "$GITHUB_REF_NAME" \
75+
--title "$GITHUB_REF_NAME" \
76+
--generate-notes \
77+
--verify-tag

0 commit comments

Comments
 (0)