Skip to content

Pre-Release Action: generate CHANGELOG #42

Pre-Release Action: generate CHANGELOG

Pre-Release Action: generate CHANGELOG #42

Workflow file for this run

name: Pre-Release Actions
on:
workflow_dispatch:
inputs:
action:
description: 'What action to perform'
required: true
type: choice
options:
- change operator version
- generate CHANGELOG
new-operator-version:
description: 'When changing the version of the operator, this is the new version to move to (e.g. 1.8.0).'
type: string
required: false
pr-owner:
description: 'GitHub ID of the pull request owner'
type: string
required: true
workflow_call:
inputs:
action:
description: 'What action to perform'
required: true
type: string
new-operator-version:
description: 'When changing the version of the operator, this is the new version to move to (e.g. 1.8.0).'
type: string
required: false
pr-owner:
description: 'GitHub ID of the pull request owner'
type: string
required: true
run-name: "Pre-Release Action: ${{ inputs.action }}"
jobs:
version-change:
runs-on: ubuntu-latest
if: ${{ inputs.action == 'change operator version' && inputs.new-operator-version != '' }}
steps:
- uses: actions/checkout@v4
- name: Change version in the source files
run: |
VERSION=${{ inputs.new-operator-version }} make change-operator-version
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: Change operator version to ${{ inputs.new-operator-version }}
title: Change operator version to ${{ inputs.new-operator-version }}
body: 'Automated changes by pre-release.yml GitHub action'
signoff: true
branch: change-operator-version-${{ inputs.new-operator-version }}
delete-branch: true
assignees: ${{ inputs.pr-owner }}
- name: Print out details of the PR opened
run: |
echo "Version Change Pull Request URL: ${{ steps.cpr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY
changelog:
runs-on: ubuntu-latest
if: ${{ inputs.action == 'generate CHANGELOG' }}
steps:
- uses: actions/checkout@v4
- name: Save current version to env
run: |
echo $(make echo-versions | grep -e '^VERSION=' ) >> $GITHUB_ENV
- name: Generate changelog
run: |
make gen-changelog
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: Update CHANGELOG for version ${{ env.VERSION }}
title: Update CHANGELOG for version ${{ env.VERSION }}
body: 'Automated changes by pre-release.yml GitHub action'
signoff: true
branch: changelog-${{ inputs.new-operator-version }}
delete-branch: true
assignees: ${{ inputs.pr-owner }}
- name: Print out details of the PR opened
run: |
echo "Changelog Pull Request URL: ${{ steps.cpr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY