Skip to content

Bump components.yaml on release branches #1112

Bump components.yaml on release branches

Bump components.yaml on release branches #1112

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-*' | grep -v 'v0.2[0-9].*\|v0.5[0-9]\.*\|v0.6[0-7]\.*' | awk '{ print $2 }' | cut -d/ -f3- | 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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ matrix.branch }}
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: "go.mod"
- name: run operator-tool bump-bugfix
run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
make components/bump-bugfix 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
./.github/scripts/generate-bump-message.sh bump-output.txt commit-message.txt pr-body.txt
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
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