Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: |
# Get tag name and message
TAG_NAME=${GITHUB_REF#refs/tags/}
TAG_MESSAGE=$(git tag -n1 "$TAG_NAME" | sed "s/^$TAG_NAME[[:space:]]*//")
TAG_MESSAGE=$(git tag -n1 "$TAG_NAME" | sed "s|^$TAG_NAME[[:space:]]*||")

# If tag message is empty, use a default
if [ -z "$TAG_MESSAGE" ]; then
Expand Down Expand Up @@ -64,16 +64,43 @@ jobs:
run: |
./scripts/bump-version.sh "${{ steps.tag_data.outputs.TAG_NAME }}"

- name: Update CHANGELOG.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./scripts/update-changelog-from-release.sh "${{ steps.tag_data.outputs.TAG_NAME }}"

- name: Commit and push changes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Check if there are changes to commit
if git diff --quiet; then
echo "No changes to commit"
exit 0
fi

git add config/manager/kustomization.yaml
git commit -m "chore: bump version to ${{ steps.tag_data.outputs.TAG_NAME }} [skip ci]"
# Create a new branch for the changes
BRANCH_NAME="release-updates-${{ steps.tag_data.outputs.TAG_NAME }}"
git checkout -b "$BRANCH_NAME"

git add config/manager/kustomization.yaml CHANGELOG.md
git commit -m "chore: bump version to ${{ steps.tag_data.outputs.TAG_NAME }} and update changelog [skip ci]"

# Push the branch and create PR
git push origin "$BRANCH_NAME"
PR_URL=$(gh pr create \
--title "chore: bump version to ${{ steps.tag_data.outputs.TAG_NAME }} and update changelog" \
--body "Automated version bump and changelog update for release ${{ steps.tag_data.outputs.TAG_NAME }}" \
--head "$BRANCH_NAME" \
--base main)

# Extract PR number from URL
PR_NUMBER=$(echo "$PR_URL" | sed 's/.*\/pull\///')
echo "Created PR #$PR_NUMBER: $PR_URL"

# Auto-approve the PR
gh pr review "$PR_NUMBER" --approve --body "Auto-approving automated release PR"

# Push to main branch
git push origin HEAD:main
# Enable auto-merge and merge the PR
gh pr merge "$PR_NUMBER" --auto --squash --delete-branch
Loading
Loading