Bump the go-dependencies group with 10 updates (#419) #32
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Configure git | |
| run: | | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| - name: Get tag information | |
| id: tag_data | |
| run: | | |
| # Get tag name and message | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| 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 | |
| TAG_MESSAGE="Release $TAG_NAME" | |
| fi | |
| echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT | |
| echo "TAG_MESSAGE<<EOF" >> $GITHUB_OUTPUT | |
| echo "$TAG_MESSAGE" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| echo "VERSION=${TAG_NAME#v}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Determine if this is a prerelease | |
| PRERELEASE="" | |
| if [[ "${{ steps.tag_data.outputs.TAG_NAME }}" =~ (alpha|beta|rc) ]]; then | |
| PRERELEASE="--prerelease" | |
| fi | |
| # Create release with auto-generated notes | |
| gh release create "${{ steps.tag_data.outputs.TAG_NAME }}" \ | |
| --title "${{ steps.tag_data.outputs.TAG_NAME }}" \ | |
| --notes "${{ steps.tag_data.outputs.TAG_MESSAGE }}" \ | |
| --generate-notes \ | |
| $PRERELEASE | |
| - name: Update kustomization.yaml | |
| 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 | |
| # 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 "[skip ci] chore: bump version to ${{ steps.tag_data.outputs.TAG_NAME }} and update changelog" | |
| # 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" | |
| # Enable auto-merge and merge the PR | |
| gh pr merge "$PR_NUMBER" --auto --squash --delete-branch |