This repository was archived by the owner on May 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
279 lines (232 loc) · 9.78 KB
/
Copy pathauto-publish.yml
File metadata and controls
279 lines (232 loc) · 9.78 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Auto Version and Publish
on:
push:
branches:
- main
paths-ignore:
- '.github/**'
- 'README.md'
- 'LICENSE'
- 'docs/**'
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
packages: write
jobs:
auto-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Configure Git
run: |
# Use PAT_TOKEN user identity if available for bypass permissions
if [ -n "${{ secrets.PAT_TOKEN }}" ]; then
git config user.name "robinmordasiewicz"
git config user.email "r.mordasiewicz@f5.com"
# Configure remote URL to use PAT for authentication
git remote set-url origin "https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}.git"
else
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
fi
- name: Auto-bump version if needed
id: version_bump
run: |
# Get current version from package.json
CURRENT_VERSION=$(jq -r '.version' package.json)
echo "Current version: $CURRENT_VERSION"
# Check if tag already exists (version already published)
if git rev-parse "v${CURRENT_VERSION}" >/dev/null 2>&1; then
echo "Version v${CURRENT_VERSION} tag already exists - auto-bumping version"
# Determine bump type from commit messages (conventional commits)
BUMP_TYPE="patch" # default to patch
# Get commits since last tag
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$LAST_TAG" ]; then
COMMIT_MESSAGES=$(git log ${LAST_TAG}..HEAD --pretty=%s)
else
COMMIT_MESSAGES=$(git log --pretty=%s)
fi
# Check for breaking changes or major version indicators
if echo "$COMMIT_MESSAGES" | grep -qE "^(BREAKING CHANGE:|feat!:|fix!:)"; then
BUMP_TYPE="major"
echo "Detected breaking changes - bumping major version"
# Check for new features
elif echo "$COMMIT_MESSAGES" | grep -qE "^feat(\(.*\))?:"; then
BUMP_TYPE="minor"
echo "Detected new features - bumping minor version"
else
echo "No major/minor indicators - bumping patch version"
fi
# Bump version in package.json using npm
npm version $BUMP_TYPE --no-git-tag-version
NEW_VERSION=$(jq -r '.version' package.json)
# Update manifest.json to match
jq --arg version "$NEW_VERSION" '.version = $version' manifest.json > manifest.json.tmp
mv manifest.json.tmp manifest.json
echo "Bumped version from $CURRENT_VERSION to $NEW_VERSION"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "version_bumped=true" >> $GITHUB_OUTPUT
# Commit version bump
git add package.json manifest.json
git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
git push
else
echo "Version v${CURRENT_VERSION} is new - ready to publish"
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "version_bumped=false" >> $GITHUB_OUTPUT
fi
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Install MCPB CLI
run: npm install -g @anthropic-ai/mcpb
- name: Build MCPB package
run: mcpb pack
- name: Get version info
id: version
run: |
VERSION="${{ steps.version_bump.outputs.version }}"
PACKAGE_NAME=$(jq -r '.name' manifest.json)
# Sanitize package name for filename (remove @ and replace / with -)
SAFE_PACKAGE_NAME=$(echo "$PACKAGE_NAME" | sed 's/@//g' | sed 's/\//-/g')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "filename=${SAFE_PACKAGE_NAME}-${VERSION}.mcpb" >> $GITHUB_OUTPUT
- name: Rename MCPB file
run: |
MCPB_FILE=$(find . -maxdepth 1 -name "*.mcpb" -type f | head -n 1)
if [ -n "$MCPB_FILE" ]; then
mv "$MCPB_FILE" "${{ steps.version.outputs.filename }}"
else
echo "Error: No .mcpb file found"
exit 1
fi
- name: Create and push tag
run: |
git tag v${{ steps.version.outputs.version }}
git push origin v${{ steps.version.outputs.version }}
- name: Generate release notes
id: release_notes
run: |
cat > release_notes.md << EOF
## F5 Cloud Status MCP Server v${{ steps.version.outputs.version }}
### Installation
**One-click installation in Claude Desktop:**
1. Download the \`.mcpb\` file below
2. Double-click the file to install
3. Restart Claude Desktop
**Manual installation using npx:**
\`\`\`json
{
"mcpServers": {
"f5xc-cloudstatus": {
"command": "npx",
"args": ["-y", "@robinmordasiewicz/f5xc-cloudstatus-mcp@${{ steps.version.outputs.version }}"]
}
}
}
\`\`\`
**Install from GitHub Packages:**
\`\`\`bash
npm install @robinmordasiewicz/f5xc-cloudstatus-mcp@${{ steps.version.outputs.version }} --registry=https://npm.pkg.github.com
\`\`\`
### What's Included
This MCPB bundle includes:
- Complete F5 Cloud Status MCP server
- All required dependencies
- Ready to use - no additional installation needed
### Features
- Real-time F5 Cloud service status monitoring
- Component health tracking (148+ components)
- Incident management and tracking
- Maintenance window information
- Intelligent caching with TTL
- Dual data sources (API + web scraper fallback)
### Documentation
- [GitHub Repository](https://github.com/robinmordasiewicz/f5xc-cloudstatus-mcp)
- [NPM Package](https://www.npmjs.com/package/@robinmordasiewicz/f5xc-cloudstatus-mcp)
- [GitHub Package](https://github.com/robinmordasiewicz/f5xc-cloudstatus-mcp/pkgs/npm/f5xc-cloudstatus-mcp)
- [Documentation](https://robinmordasiewicz.github.io/f5xc-cloudstatus-mcp/)
EOF
echo "notes_file=release_notes.md" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: v${{ steps.version.outputs.version }}
body_path: ${{ steps.release_notes.outputs.notes_file }}
draft: false
prerelease: false
files: |
${{ steps.version.outputs.filename }}
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
- name: Setup Node.js for GitHub Packages
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://npm.pkg.github.com'
scope: '@robinmordasiewicz'
- name: Configure package for GitHub Packages
run: |
cp package.json package.json.backup
jq '.name = "@robinmordasiewicz/f5xc-cloudstatus-mcp" |
.publishConfig = {"registry": "https://npm.pkg.github.com"}' \
package.json > package.json.tmp
mv package.json.tmp package.json
- name: Publish to GitHub Packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore package.json
if: always()
run: |
if [ -f package.json.backup ]; then
mv package.json.backup package.json
fi
- name: Prepare for npm publish
run: |
# Remove publishConfig to ensure clean state for npm publish
jq 'del(.publishConfig)' package.json > package.json.tmp
mv package.json.tmp package.json
echo "📝 Verified package.json - publishConfig removed"
# Remove .npmrc created by previous setup-node action
rm -f .npmrc
rm -f ~/.npmrc
rm -f /home/runner/.npmrc 2>/dev/null || true
# Create new .npmrc for npmjs.org with auth token
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "📝 Created clean .npmrc for npmjs.org"
echo "Registry configuration:"
npm config get registry
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm
run: |
# Clear the NPM_CONFIG_USERCONFIG environment variable that's set by setup-node
unset NPM_CONFIG_USERCONFIG
# Double-check registry configuration
npm config set registry https://registry.npmjs.org/
echo "Publishing to: $(npm config get registry)"
# Publish with explicit registry flag
npm publish --access public --registry https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Upload MCPB artifact
uses: actions/upload-artifact@v4
with:
name: mcpb-package-v${{ steps.version.outputs.version }}
path: ${{ steps.version.outputs.filename }}
retention-days: 90