|
| 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 |
0 commit comments