Skip to content

Commit d42a25f

Browse files
committed
Add GitHub Actions release workflow
- Triggers on .blogkit/ or workflow script changes - Supports manual trigger with optional version input - Validates packages before release - Creates GitHub release with 34 template variants - Generates release notes with SHA-256 checksums
1 parent 4989044 commit d42a25f

2 files changed

Lines changed: 130 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Release Blog-Tech-Kit Templates
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- '.blogkit/**'
8+
- '.github/workflows/scripts/**'
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'Version to release (e.g., v0.1.0). Leave empty for auto-increment.'
13+
required: false
14+
type: string
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Get next version
29+
id: version
30+
run: |
31+
chmod +x .github/workflows/scripts/get-next-version.sh
32+
33+
if [[ -n "${{ inputs.version }}" ]]; then
34+
echo "new_version=${{ inputs.version }}" >> $GITHUB_OUTPUT
35+
echo "Using provided version: ${{ inputs.version }}"
36+
else
37+
NEW_VERSION=$(.github/workflows/scripts/get-next-version.sh)
38+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
39+
echo "Auto-detected version: $NEW_VERSION"
40+
fi
41+
42+
- name: Check if release exists
43+
id: check_release
44+
run: |
45+
chmod +x .github/workflows/scripts/check-release-exists.sh
46+
47+
if .github/workflows/scripts/check-release-exists.sh "${{ steps.version.outputs.new_version }}"; then
48+
echo "exists=true" >> $GITHUB_OUTPUT
49+
echo "Release ${{ steps.version.outputs.new_version }} already exists, skipping."
50+
else
51+
echo "exists=false" >> $GITHUB_OUTPUT
52+
echo "Release ${{ steps.version.outputs.new_version }} does not exist, proceeding."
53+
fi
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Create release packages
58+
if: steps.check_release.outputs.exists == 'false'
59+
run: |
60+
chmod +x .github/workflows/scripts/create-release-packages.sh
61+
.github/workflows/scripts/create-release-packages.sh "${{ steps.version.outputs.new_version }}"
62+
63+
echo "Generated packages:"
64+
ls -la .genreleases/*.zip | wc -l
65+
echo "files"
66+
67+
- name: Validate release packages
68+
if: steps.check_release.outputs.exists == 'false'
69+
run: |
70+
chmod +x scripts/test-auto-release.sh
71+
72+
# Run validation tests (skip reference comparison in CI)
73+
echo "Running package validation..."
74+
75+
# Quick validation: check ZIP count and structure
76+
ZIP_COUNT=$(ls -1 .genreleases/*.zip 2>/dev/null | wc -l)
77+
echo "ZIP files created: $ZIP_COUNT"
78+
79+
if [[ "$ZIP_COUNT" -lt 30 ]]; then
80+
echo "ERROR: Expected at least 30 ZIP files, got $ZIP_COUNT"
81+
exit 1
82+
fi
83+
84+
# Spot-check one variant
85+
unzip -q -d /tmp/validate-check .genreleases/spec-kit-template-claude-sh-*.zip
86+
87+
if [[ -d "/tmp/validate-check/spec-kit-template-claude-sh-${{ steps.version.outputs.new_version }}/.blogkit" ]]; then
88+
echo "✅ Package structure validated"
89+
else
90+
echo "❌ Package structure invalid"
91+
exit 1
92+
fi
93+
94+
# Check for blogkit commands
95+
CMD_COUNT=$(ls -1 /tmp/validate-check/spec-kit-template-claude-sh-*/.claude/commands/blogkit.*.md 2>/dev/null | wc -l)
96+
if [[ "$CMD_COUNT" -eq 9 ]]; then
97+
echo "✅ Command count validated: $CMD_COUNT"
98+
else
99+
echo "❌ Expected 9 commands, got $CMD_COUNT"
100+
exit 1
101+
fi
102+
103+
- name: Generate release notes
104+
if: steps.check_release.outputs.exists == 'false'
105+
id: release_notes
106+
run: |
107+
chmod +x .github/workflows/scripts/generate-release-notes.sh
108+
.github/workflows/scripts/generate-release-notes.sh "${{ steps.version.outputs.new_version }}"
109+
110+
echo "Release notes generated"
111+
112+
- name: Create GitHub release
113+
if: steps.check_release.outputs.exists == 'false'
114+
run: |
115+
chmod +x .github/workflows/scripts/create-github-release.sh
116+
.github/workflows/scripts/create-github-release.sh "${{ steps.version.outputs.new_version }}"
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
120+
- name: Summary
121+
if: steps.check_release.outputs.exists == 'false'
122+
run: |
123+
echo "## 🚀 Release Created" >> $GITHUB_STEP_SUMMARY
124+
echo "" >> $GITHUB_STEP_SUMMARY
125+
echo "**Version:** ${{ steps.version.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY
126+
echo "" >> $GITHUB_STEP_SUMMARY
127+
echo "**Packages:** $(ls -1 .genreleases/*.zip | wc -l) template variants" >> $GITHUB_STEP_SUMMARY
128+
echo "" >> $GITHUB_STEP_SUMMARY
129+
echo "View the release: https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/scripts/generate-release-notes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $COMMITS
3636
3737
## Assets
3838
39-
36 template variants (18 agents × 2 script types) with SHA-256 checksums:
39+
34 template variants (17 agents × 2 script types) with SHA-256 checksums:
4040
4141
EOF
4242

0 commit comments

Comments
 (0)