-
Notifications
You must be signed in to change notification settings - Fork 9
65 lines (58 loc) · 2.55 KB
/
Copy pathrelease.yml
File metadata and controls
65 lines (58 loc) · 2.55 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
name: Publish Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify tag matches plugin.json version
run: |
TAG="${GITHUB_REF_NAME#v}"
PLUGIN_VERSION=$(python -c "import json; print(json.load(open('.claude-plugin/plugin.json'))['version'])")
echo "Tag version: $TAG"
echo "plugin.json: $PLUGIN_VERSION"
if [ "$TAG" != "$PLUGIN_VERSION" ]; then
echo "::error::Tag v$TAG does not match plugin.json version $PLUGIN_VERSION. Bump plugin.json before tagging."
exit 1
fi
- name: Verify .mcp.json version matches plugin.json version
run: |
PLUGIN_VERSION=$(python -c "import json; print(json.load(open('.claude-plugin/plugin.json'))['version'])")
MCP_PLUGIN_VERSION=$(python -c "import json; print(json.load(open('.mcp.json'))['mcpServers']['postman']['headers']['X-Plugin-Version'])")
MCP_USER_AGENT=$(python -c "import json; print(json.load(open('.mcp.json'))['mcpServers']['postman']['headers']['User-Agent'])")
echo "plugin.json: $PLUGIN_VERSION"
echo ".mcp.json X-Plugin-Version: $MCP_PLUGIN_VERSION"
echo ".mcp.json User-Agent: $MCP_USER_AGENT"
if [ "$MCP_PLUGIN_VERSION" != "$PLUGIN_VERSION" ] || [ "$MCP_USER_AGENT" != "postman-claude-code-plugin/$PLUGIN_VERSION" ]; then
echo "::error::.mcp.json version headers do not match plugin.json version $PLUGIN_VERSION. Update X-Plugin-Version and User-Agent in .mcp.json before tagging."
exit 1
fi
- name: Extract release notes from CHANGELOG
id: notes
run: |
TAG="${GITHUB_REF_NAME#v}"
# Print the body of the "## [X.Y.Z]" section, stopping at the next "## " heading.
awk -v ver="$TAG" '
$0 ~ "^## \\[" ver "\\]" { grab=1; next }
grab && /^## / { exit }
grab { print }
' CHANGELOG.md > release-notes.md
if [ ! -s release-notes.md ]; then
echo "::error::No CHANGELOG section found for version $TAG. Add a '## [$TAG]' entry."
exit 1
fi
echo "Release notes:"
cat release-notes.md
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--notes-file release-notes.md