-
Notifications
You must be signed in to change notification settings - Fork 6
151 lines (131 loc) · 4.72 KB
/
release.yml
File metadata and controls
151 lines (131 loc) · 4.72 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v1.4.0)'
required: true
permissions:
contents: write
jobs:
validate:
name: Pre-release Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
else
TAG="${GITHUB_REF#refs/tags/}"
fi
VERSION="${TAG#v}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Verify version consistency
run: |
VERSION="${{ steps.version.outputs.version }}"
PLUGIN_VERSION=$(python3 -c "import json; print(json.load(open('.claude-plugin/plugin.json'))['version'])")
MARKET_VERSION=$(python3 -c "import json; print(json.load(open('.claude-plugin/marketplace.json'))['plugins'][0]['version'])")
echo "Tag version: $VERSION"
echo "plugin.json version: $PLUGIN_VERSION"
echo "marketplace version: $MARKET_VERSION"
if [ "$PLUGIN_VERSION" != "$VERSION" ] || [ "$MARKET_VERSION" != "$VERSION" ]; then
echo "::error::Version mismatch! Tag=$VERSION plugin.json=$PLUGIN_VERSION marketplace.json=$MARKET_VERSION"
exit 1
fi
echo "✓ Version consistent across all files"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install test dependencies
run: pip install -r requirements-dev.txt
- name: Run static tests
run: pytest tests/static/ -v
- name: Check layer separation
run: |
result=$(grep -r --exclude-dir='*-workspace' "docs/\|\.claude/" rules/ skills/ knowledge/ 2>/dev/null || true)
if [ -n "$result" ]; then
echo "::error::Layer separation violation"
echo "$result"
exit 1
fi
release:
name: Create Release
needs: validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
else
TAG="${GITHUB_REF#refs/tags/}"
fi
VERSION="${TAG#v}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Extract changelog
id: changelog
run: |
NOTES=$(python3 dev-scripts/extract-changelog.py "${{ steps.version.outputs.version }}")
# Write to file for gh release
echo "$NOTES" > /tmp/release-notes.md
- name: Package product layer
run: |
mkdir -p dist
tar -czf "dist/devpace-${{ steps.version.outputs.version }}.tar.gz" \
.claude-plugin/ \
rules/ \
skills/ \
knowledge/ \
hooks/ \
agents/ \
output-styles/ \
settings.json \
README.md \
README_zh.md \
LICENSE \
CHANGELOG.md \
CONTRIBUTING.md \
CONTRIBUTING_zh.md
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.version.outputs.tag }}" \
--title "devpace ${{ steps.version.outputs.tag }}" \
--notes-file /tmp/release-notes.md \
"dist/devpace-${{ steps.version.outputs.version }}.tar.gz"
- name: Sync marketplace index
env:
GH_TOKEN: ${{ secrets.MARKETPLACE_PAT }}
run: |
VERSION="${{ steps.version.outputs.version }}"
TAG="${{ steps.version.outputs.tag }}"
git clone https://x-access-token:${GH_TOKEN}@github.com/arch-team/devpace-marketplace.git /tmp/marketplace
cd /tmp/marketplace
python3 -c "
import json
path = '.claude-plugin/marketplace.json'
with open(path) as f:
data = json.load(f)
data['plugins'][0]['version'] = '${VERSION}'
data['plugins'][0]['source']['ref'] = '${TAG}'
with open(path, 'w') as f:
json.dump(data, f, indent=2, ensure_ascii=False)
f.write('\n')
"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .claude-plugin/marketplace.json
git commit -m "chore: sync devpace ${TAG}" || echo "No changes"
git push