|
5 | 5 | - '**/v*.*.*' # Matches tags like evm/single/v0.2.0, testapp/v0.4.0, etc. |
6 | 6 |
|
7 | 7 | permissions: {} |
| 8 | + |
8 | 9 | jobs: |
| 10 | + generate-changelog: |
| 11 | + name: Generate Changelog and Create Release Branch |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + outputs: |
| 16 | + changelog: ${{ steps.cliff.outputs.content }} |
| 17 | + release-branch: ${{ steps.create-branch.outputs.branch-name }} |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v6 |
| 21 | + with: |
| 22 | + fetch-depth: 0 # Full history needed for changelog generation |
| 23 | + |
| 24 | + - name: Install git-cliff |
| 25 | + uses: taiki-e/install-action@v2 |
| 26 | + with: |
| 27 | + tool: git-cliff |
| 28 | + |
| 29 | + - name: Generate changelog |
| 30 | + id: cliff |
| 31 | + run: | |
| 32 | + # Generate changelog from CHANGELOG.md for this release |
| 33 | + CHANGELOG_CONTENT=$(git cliff --unreleased --strip all) |
| 34 | +
|
| 35 | + # Save to file and output |
| 36 | + echo "$CHANGELOG_CONTENT" > RELEASE_CHANGELOG.md |
| 37 | + echo "Generated changelog:" |
| 38 | + cat RELEASE_CHANGELOG.md |
| 39 | +
|
| 40 | + # Export for GitHub Release (escape for multiline output) |
| 41 | + { |
| 42 | + echo 'content<<EOF' |
| 43 | + echo "$CHANGELOG_CONTENT" |
| 44 | + echo EOF |
| 45 | + } >> $GITHUB_OUTPUT |
| 46 | +
|
| 47 | + - name: Create release branch |
| 48 | + id: create-branch |
| 49 | + run: | |
| 50 | + TAG="${{ github.ref_name }}" |
| 51 | + BRANCH_NAME="release/$TAG" |
| 52 | +
|
| 53 | + echo "Creating release branch: $BRANCH_NAME" |
| 54 | + git config user.name "github-actions[bot]" |
| 55 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 56 | +
|
| 57 | + git checkout -b "$BRANCH_NAME" |
| 58 | +
|
| 59 | + # Update CHANGELOG.md with the generated content |
| 60 | + if [ -f "CHANGELOG.md" ]; then |
| 61 | + # Add generated changelog to CHANGELOG.md |
| 62 | + cat RELEASE_CHANGELOG.md >> CHANGELOG_RELEASE_NOTES.md |
| 63 | + echo "Changelog prepared for release: $TAG" >> CHANGELOG_RELEASE_NOTES.md |
| 64 | + fi |
| 65 | +
|
| 66 | + # Commit the changelog |
| 67 | + git add -A |
| 68 | + if git diff --staged --quiet; then |
| 69 | + echo "No changes to commit" |
| 70 | + else |
| 71 | + git commit -m "chore: prepare release $TAG" \ |
| 72 | + -m "Generated changelog for $TAG release." \ |
| 73 | + -m "This is an automated commit created by the release workflow." |
| 74 | + fi |
| 75 | +
|
| 76 | + # Push the branch |
| 77 | + git push origin "$BRANCH_NAME" |
| 78 | +
|
| 79 | + echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT |
| 80 | + echo "::notice::Created release branch: $BRANCH_NAME" |
| 81 | +
|
9 | 82 | parse-tag: |
10 | 83 | name: Parse Release Tag |
11 | 84 | runs-on: ubuntu-latest |
@@ -85,3 +158,51 @@ jobs: |
85 | 158 | tags: | |
86 | 159 | ghcr.io/${{ github.repository_owner }}/${{ needs.parse-tag.outputs.image-name }}:${{ needs.parse-tag.outputs.version }} |
87 | 160 | ghcr.io/${{ github.repository_owner }}/${{ needs.parse-tag.outputs.image-name }}:latest |
| 161 | +
|
| 162 | + create-github-release: |
| 163 | + name: Create GitHub Release |
| 164 | + needs: [generate-changelog, parse-tag, build-and-push] |
| 165 | + runs-on: ubuntu-latest |
| 166 | + permissions: |
| 167 | + contents: write |
| 168 | + steps: |
| 169 | + - name: Create GitHub Release |
| 170 | + uses: softprops/action-gh-release@v2 |
| 171 | + with: |
| 172 | + draft: true |
| 173 | + name: ${{ github.ref_name }} |
| 174 | + tag_name: ${{ github.ref_name }} |
| 175 | + body: | |
| 176 | + ## ${{ needs.parse-tag.outputs.image-name }} ${{ needs.parse-tag.outputs.version }} |
| 177 | +
|
| 178 | + **⚠️ This is a draft release. Please update the following before publishing:** |
| 179 | +
|
| 180 | + - [ ] Add **Upgrade Priority** (Critical/High/Medium/Low) |
| 181 | + - [ ] Add **General Description** of the release |
| 182 | + - [ ] Review and refine the **Changelog** below |
| 183 | + - [ ] Document **Tested Upgrade Paths** (which versions were tested in E2E) |
| 184 | + - [ ] Verify Docker images are available |
| 185 | + - [ ] Publish announcements in Slack and Telegram after publishing |
| 186 | +
|
| 187 | + --- |
| 188 | +
|
| 189 | + ### Changelog |
| 190 | +
|
| 191 | + ${{ needs.generate-changelog.outputs.changelog }} |
| 192 | +
|
| 193 | + --- |
| 194 | +
|
| 195 | + ### Docker Images |
| 196 | +
|
| 197 | + ```bash |
| 198 | + docker pull ghcr.io/${{ github.repository_owner }}/${{ needs.parse-tag.outputs.image-name }}:${{ needs.parse-tag.outputs.version }} |
| 199 | + docker pull ghcr.io/${{ github.repository_owner }}/${{ needs.parse-tag.outputs.image-name }}:latest |
| 200 | + ``` |
| 201 | +
|
| 202 | + ### Release Branch |
| 203 | +
|
| 204 | + A release branch has been created for your review: `${{ needs.generate-changelog.outputs.release-branch }}` |
| 205 | +
|
| 206 | + You can checkout this branch to make edits to the changelog before merging. |
| 207 | + env: |
| 208 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments