Skip to content

Prepare the release

Prepare the release #6

name: "Prepare the release"
on:
workflow_dispatch:
inputs:
version:
description: version of the operator to release
required: true
env:
OPERATOR_BOT_USER: tempooperatorbot
jobs:
prepare-release:
runs-on: ubuntu-22.04
steps:
- name: Sync fork
env:
GH_TOKEN: ${{ secrets.TEMPOOPERATORBOT_GITHUB_TOKEN }}
run: |
# synchronizing the fork is fast, and avoids the need to fetch the full upstream repo
# (fetching the upstream repo with "--depth 1" would lead to "shallow update not allowed"
# error when pushing back to the origin repo)
gh repo sync $OPERATOR_BOT_USER/${{ github.event.repository.name }} \
--source ${{ github.repository }} \
--force
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ env.OPERATOR_BOT_USER }}/${{ github.event.repository.name }}
token: ${{ secrets.TEMPOOPERATORBOT_GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Update makefile
run: sed -i.bak "s/OPERATOR_VERSION ?= .*/OPERATOR_VERSION ?= $OPERATOR_VERSION/g" Makefile && rm Makefile.bak
env:
OPERATOR_VERSION: ${{inputs.version}}
- name: Generate bundle
run: make bundle
env:
OPERATOR_VERSION: ${{inputs.version}}
IMG_PREFIX: ghcr.io/${{ github.repository }}
- name: Generate CHANGELOG
run: make chlog-update
env:
OPERATOR_VERSION: ${{inputs.version}}
# Commit all changed files back to the repository
- name: Commit the changes to the repository and create PR
run: |
git config user.name "$OPERATOR_BOT_USER"
git config user.email "[email protected]"
git checkout -b releases/${{ inputs.version }}
git add -A
git commit -m "Prepare Release ${{inputs.version}}" --author="${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
git push -f --set-upstream origin releases/${{ inputs.version }}
gh pr create \
--title='Prepare release v${{ inputs.version }}' \
--body='v${{ inputs.version }}'\
--repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.TEMPOOPERATORBOT_GITHUB_TOKEN }}