Auto-Bump Component's Versions #1335
This file contains 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: Auto-Bump Component's Versions | |
on: | |
schedule: | |
- cron: '0 5 * * *' | |
workflow_dispatch: | |
inputs: | |
component: | |
description: 'Component to bump' | |
required: false | |
version: | |
description: 'Component version' | |
required: false | |
jobs: | |
set_bump_branches: | |
name: Get Branches to Bump Components Versions | |
if: (github.repository == 'kubevirt/hyperconverged-cluster-operator') | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set_branches.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- id: set_branches | |
run: | | |
if [[ ${{ github.event_name }} == "workflow_dispatch" && ${{ github.ref }} != "refs/heads/main" ]]; then | |
matrix="[{\"branch\": \"${GITHUB_REF#refs/heads/}\"}]" | |
else | |
matrix=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin | grep -e "origin/main" -e "origin/release-1.[0-9]\+$" | grep -v "release-1\.[0,1,2,3]$" | sed -r 's/origin\/(.*)/{"branch": "\1"}/g' | jq -s) | |
fi | |
echo "matrix={\"branches\":$(echo $matrix)}" >> $GITHUB_OUTPUT | |
bump_components_version: | |
name: Bump Components Versions | |
if: (github.repository == 'kubevirt/hyperconverged-cluster-operator') | |
runs-on: ubuntu-latest | |
needs: set_bump_branches | |
strategy: | |
matrix: ${{fromJson(needs.set_bump_branches.outputs.matrix)}} | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.branches.branch }} | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' # The Go version to download (if necessary) and use. | |
- name: Check for new releases and update | |
env: | |
UPDATED_COMPONENT: ${{ github.event.inputs.component }} | |
UPDATED_VERSION: ${{ github.event.inputs.version }} | |
run: | | |
curl -s https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/main/automation/release-bumper/release-bumper.sh | bash | |
if [[ -f updated_component.txt ]]; then | |
echo 'UPDATED_COMPONENT<<EOF' >> $GITHUB_ENV | |
cat updated_component.txt >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
UPDATED_COMPONENT_EXISTS=true | |
fi | |
if [[ -f updated_version.txt ]]; then | |
echo 'UPDATED_VERSION<<EOF' >> $GITHUB_ENV | |
cat updated_version.txt >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
UPDATED_VERSION_EXISTS=true | |
fi | |
if [[ -n ${UPDATED_COMPONENT_EXISTS} && -n ${UPDATED_VERSION_EXISTS} ]]; then | |
echo "CHANGED=true" >> $GITHUB_ENV | |
fi | |
- name: Remove temporary files | |
if: ${{ env.CHANGED }} | |
run: rm -f updated_component.txt updated_version.txt | |
- uses: peter-evans/create-pull-request@v6 | |
if: ${{ env.CHANGED }} | |
with: | |
token: ${{ secrets.HCO_BOT_TOKEN }} | |
commit-message: | | |
Bump ${{ env.UPDATED_COMPONENT }} to ${{ env.UPDATED_VERSION }} | |
Signed-off-by: HCO Bump Bot <noreply@github.com> | |
committer: HCO Bump Bot <noreply@github.com> | |
title: "[${{ matrix.branches.branch }}] Bump ${{ env.UPDATED_COMPONENT }} to ${{ env.UPDATED_VERSION }}" | |
body: | | |
Bump ${{ env.UPDATED_COMPONENT }} to ${{ env.UPDATED_VERSION }} | |
Executed by HCO Release-Bumper Bot. | |
```release-note | |
Bump ${{ env.UPDATED_COMPONENT }} to ${{ env.UPDATED_VERSION }} | |
``` | |
assignees: tiraboschi,orenc1,nunnatsa,machadovilaca,dharmit | |
reviewers: tiraboschi,orenc1,nunnatsa,machadovilaca,dharmit | |
branch: bump_${{ env.UPDATED_COMPONENT }}_${{ env.UPDATED_VERSION }}_${{ matrix.branches.branch }} |