|
30 | 30 | run: | |
31 | 31 | # Get tag name and message |
32 | 32 | TAG_NAME=${GITHUB_REF#refs/tags/} |
33 | | - TAG_MESSAGE=$(git tag -n1 "$TAG_NAME" | sed "s/^$TAG_NAME[[:space:]]*//") |
| 33 | + TAG_MESSAGE=$(git tag -n1 "$TAG_NAME" | sed "s|^$TAG_NAME[[:space:]]*||") |
34 | 34 |
|
35 | 35 | # If tag message is empty, use a default |
36 | 36 | if [ -z "$TAG_MESSAGE" ]; then |
@@ -64,16 +64,43 @@ jobs: |
64 | 64 | run: | |
65 | 65 | ./scripts/bump-version.sh "${{ steps.tag_data.outputs.TAG_NAME }}" |
66 | 66 |
|
| 67 | + - name: Update CHANGELOG.md |
| 68 | + env: |
| 69 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + run: | |
| 71 | + ./scripts/update-changelog-from-release.sh "${{ steps.tag_data.outputs.TAG_NAME }}" |
| 72 | +
|
67 | 73 | - name: Commit and push changes |
| 74 | + env: |
| 75 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
68 | 76 | run: | |
69 | 77 | # Check if there are changes to commit |
70 | 78 | if git diff --quiet; then |
71 | 79 | echo "No changes to commit" |
72 | 80 | exit 0 |
73 | 81 | fi |
74 | 82 |
|
75 | | - git add config/manager/kustomization.yaml |
76 | | - git commit -m "chore: bump version to ${{ steps.tag_data.outputs.TAG_NAME }} [skip ci]" |
| 83 | + # Create a new branch for the changes |
| 84 | + BRANCH_NAME="release-updates-${{ steps.tag_data.outputs.TAG_NAME }}" |
| 85 | + git checkout -b "$BRANCH_NAME" |
| 86 | +
|
| 87 | + git add config/manager/kustomization.yaml CHANGELOG.md |
| 88 | + git commit -m "chore: bump version to ${{ steps.tag_data.outputs.TAG_NAME }} and update changelog [skip ci]" |
| 89 | +
|
| 90 | + # Push the branch and create PR |
| 91 | + git push origin "$BRANCH_NAME" |
| 92 | + PR_URL=$(gh pr create \ |
| 93 | + --title "chore: bump version to ${{ steps.tag_data.outputs.TAG_NAME }} and update changelog" \ |
| 94 | + --body "Automated version bump and changelog update for release ${{ steps.tag_data.outputs.TAG_NAME }}" \ |
| 95 | + --head "$BRANCH_NAME" \ |
| 96 | + --base main) |
| 97 | +
|
| 98 | + # Extract PR number from URL |
| 99 | + PR_NUMBER=$(echo "$PR_URL" | sed 's/.*\/pull\///') |
| 100 | + echo "Created PR #$PR_NUMBER: $PR_URL" |
| 101 | +
|
| 102 | + # Auto-approve the PR |
| 103 | + gh pr review "$PR_NUMBER" --approve --body "Auto-approving automated release PR" |
77 | 104 |
|
78 | | - # Push to main branch |
79 | | - git push origin HEAD:main |
| 105 | + # Enable auto-merge and merge the PR |
| 106 | + gh pr merge "$PR_NUMBER" --auto --squash --delete-branch |
0 commit comments