Bump components.yaml on release branches #1138
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: Bump components.yaml on release branches | |
| on: # yamllint disable-line rule:truthy | |
| workflow_dispatch: {} | |
| schedule: | |
| # Run this every week day at 2AM | |
| - cron: '0 2 * * 1-5' | |
| permissions: {} | |
| jobs: | |
| build-release-matrix: | |
| runs-on: ubuntu-latest | |
| permissions: {} | |
| if: github.repository_owner == 'tektoncd' # do not run this elsewhere | |
| steps: | |
| - id: set-matrix | |
| run: | | |
| SUPPORTED_BRANCHES=$(git ls-remote --heads https://github.com/tektoncd/operator 'release-*' | awk '{ print $2 }' | cut -d/ -f3- | grep '^release-v[0-9]\+\.[0-9]\+' | grep -v '^release-v0\.2[0-9]\|^release-v0\.5[0-9]\|^release-v0\.6[0-7]' | jq -cRs 'split("\n")[:-1]') | |
| echo "Supported Branches: ${SUPPORTED_BRANCHES}" | |
| echo "branches=${SUPPORTED_BRANCHES}" >> $GITHUB_OUTPUT | |
| outputs: | |
| branches: ${{ steps.set-matrix.outputs.branches }} | |
| bump-payloads: | |
| needs: build-release-matrix | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| strategy: | |
| matrix: | |
| branch: ${{ fromJSON(needs.build-release-matrix.outputs.branches) }} | |
| # branch: [release-v0.62.x, release-v0.63.x] | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: main | |
| persist-credentials: false | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Build operator tool and cache scripts from main | |
| run: | | |
| go build -o /tmp/operator-tool ./cmd/tool | |
| cp .github/scripts/generate-bump-message.sh /tmp/generate-bump-message.sh | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| persist-credentials: false | |
| - name: run operator-tool bump-bugfix | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| /tmp/operator-tool bump --bugfix components.yaml 2> bump-output.txt || true | |
| cat bump-output.txt >&2 | |
| - name: generate commit message and PR body | |
| id: generate-message | |
| run: | | |
| if [[ -f bump-output.txt ]]; then | |
| /tmp/generate-bump-message.sh bump-output.txt commit-message.txt pr-body.txt | |
| fi | |
| if [[ -f commit-message.txt ]]; then | |
| COMMIT_MSG=$(cat commit-message.txt) | |
| PR_TITLE=$(head -n1 commit-message.txt) | |
| echo "commit_message<<EOF" >> $GITHUB_OUTPUT | |
| echo "${COMMIT_MSG}" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| echo "pr_title=${PR_TITLE}" >> $GITHUB_OUTPUT | |
| if [[ -f pr-body.txt ]]; then | |
| echo "pr_body<<EOF" >> $GITHUB_OUTPUT | |
| cat pr-body.txt >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "commit_message=chore: bump payload versions" >> $GITHUB_OUTPUT | |
| echo "pr_title=chore: bump payload versions" >> $GITHUB_OUTPUT | |
| echo "pr_body=Automated component version bump for ${MATRIX_BRANCH}" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| MATRIX_BRANCH: ${{ matrix.branch }} | |
| - name: clean up temporary files | |
| run: | | |
| rm -f bump-output.txt commit-message.txt pr-body.txt | |
| - name: create pull request | |
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | |
| with: | |
| token: ${{ secrets.CHATOPS_TOKEN }} | |
| commit-message: ${{ steps.generate-message.outputs.commit_message }} | |
| committer: tekton-bot <tekton-bot@users.noreply.github.com> | |
| author: Vincent Demeester <vdemeest@redhat.com> | |
| signoff: true | |
| # author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
| branch: bot-bump-payload-${{ matrix.branch }} | |
| delete-branch: true | |
| title: ${{ steps.generate-message.outputs.pr_title }} | |
| body: ${{ steps.generate-message.outputs.pr_body }} | |
| labels: | | |
| release-note-none |