-
Notifications
You must be signed in to change notification settings - Fork 314
Expand file tree
/
Copy pathpackage-release-claude-code.yaml
More file actions
161 lines (143 loc) · 5.57 KB
/
package-release-claude-code.yaml
File metadata and controls
161 lines (143 loc) · 5.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Claude Code Plugin Release
on:
push:
tags:
- 'package-claude-code/v*'
permissions:
contents: write
jobs:
verify:
name: Verify & Build
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: src/packages/claude-code
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: '22'
- name: Extract version from package.json
id: pkg_version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Package version: $VERSION"
- name: Extract version from tag
id: tag_version
env:
GIT_REF: ${{ github.ref }}
run: |
if [[ "$GIT_REF" == refs/tags/* ]]; then
TAG_NAME=${GIT_REF#refs/tags/package-claude-code/v}
echo "version=$TAG_NAME" >> "$GITHUB_OUTPUT"
echo "Tag version: $TAG_NAME"
else
echo "version=" >> "$GITHUB_OUTPUT"
fi
- name: Verify tag matches package.json
if: steps.tag_version.outputs.version != ''
env:
PKG_VERSION: ${{ steps.pkg_version.outputs.version }}
TAG_VERSION: ${{ steps.tag_version.outputs.version }}
run: |
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
echo "Error: package.json version ($PKG_VERSION) does not match tag version ($TAG_VERSION)"
exit 1
fi
echo "Version match: $PKG_VERSION"
- name: Verify plugin.json version
env:
PKG_VERSION: ${{ steps.pkg_version.outputs.version }}
run: |
PLUGIN_VERSION=$(node -p "require('./plugin/.claude-plugin/plugin.json').version")
if [ "$PKG_VERSION" != "$PLUGIN_VERSION" ]; then
echo "Error: plugin.json version ($PLUGIN_VERSION) does not match package.json ($PKG_VERSION)"
echo "Hint: run 'npm run release -- $PKG_VERSION' to sync all versions"
exit 1
fi
echo "plugin.json version: $PLUGIN_VERSION ✓"
- name: Verify marketplace.json version
env:
PKG_VERSION: ${{ steps.pkg_version.outputs.version }}
run: |
MKT_VERSION=$(node -p "require('../../../.claude-plugin/marketplace.json').plugins.find(p => p.name === 'acontext').version")
if [ "$PKG_VERSION" != "$MKT_VERSION" ]; then
echo "Error: marketplace.json version ($MKT_VERSION) does not match package.json ($PKG_VERSION)"
echo "Hint: run 'npm run release -- $PKG_VERSION' to sync all versions"
exit 1
fi
echo "marketplace.json version: $MKT_VERSION ✓"
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
- name: Build
run: npm run build
- name: Verify build output exists
run: |
node -e "
const fs = require('fs');
const files = ['plugin/scripts/mcp-server.cjs', 'plugin/scripts/hook-handler.cjs'];
for (const f of files) {
if (!fs.existsSync(f)) { console.error('Missing: ' + f); process.exit(1); }
const stat = fs.statSync(f);
if (stat.size < 1000) { console.error('Suspiciously small: ' + f + ' (' + stat.size + ' bytes)'); process.exit(1); }
console.log('OK: ' + f + ' (' + (stat.size / 1024).toFixed(0) + ' KB)');
}
"
- name: Verify bundles match committed artifacts
run: |
if git diff --name-only -- plugin/scripts/ | grep -q .; then
echo "Error: Committed bundles differ from a clean rebuild:"
git diff --stat -- plugin/scripts/
echo ""
echo "Hint: run 'npm run release -- X.Y.Z' to rebuild and commit the updated bundles."
exit 1
fi
echo "Bundles match committed artifacts ✓"
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
timeout-minutes: 10
needs: verify
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- name: Extract version from tag
id: version
env:
GIT_REF: ${{ github.ref }}
run: |
TAG_NAME=${GIT_REF#refs/tags/package-claude-code/v}
echo "version=$TAG_NAME" >> "$GITHUB_OUTPUT"
- name: Generate Changelog
env:
CHANGELOG_OUTPUT: ${{ github.workspace }}-CHANGELOG.txt
run: |
FOOTER=$(printf '%s\n' \
"## Installation" \
"" \
'```bash' \
"claude mcp add-from-marketplace acontext --publisher memodb-io" \
'```' \
"" \
"## Release Checklist" \
"- [x] Version synced across package.json, plugin.json, marketplace.json" \
"- [x] Tests passed" \
"- [x] Plugin bundles built and verified")
bash .github/scripts/generate-changelog.sh \
--tag-prefix "package-claude-code/v" \
--source-dir "src/packages/claude-code" \
--display-name "Claude Code Plugin" \
--output "$CHANGELOG_OUTPUT" \
--footer "$FOOTER"
- name: Create Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda
with:
body_path: ${{ github.workspace }}-CHANGELOG.txt