Init Release #3
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: Init Release | |
on: | |
workflow_dispatch: | |
inputs: | |
TARGET_BRANCH: | |
description: 'TARGET_BRANCH on which release will be based' | |
required: true | |
type: string | |
TARGET_VERSION: | |
description: 'TARGET_VERSION to build kubernetes manifests with using Kustomize' | |
required: true | |
type: string | |
permissions: {} | |
jobs: | |
prepare-release: | |
permissions: | |
contents: write # for peter-evans/create-pull-request to create branch | |
pull-requests: write # for peter-evans/create-pull-request to create a PR | |
name: Automatically generate version and manifests on ${{ inputs.TARGET_BRANCH }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ inputs.TARGET_BRANCH }} | |
- name: Check if TARGET_VERSION is well formed. | |
run: | | |
set -xue | |
# Target version must not contain 'v' prefix | |
if echo "${{ inputs.TARGET_VERSION }}" | grep -e '^v'; then | |
echo "::error::Target version '${{ inputs.TARGET_VERSION }}' should not begin with a 'v' prefix, refusing to continue." >&2 | |
exit 1 | |
fi | |
- name: Create VERSION information | |
run: | | |
set -ue | |
echo "Bumping version from $(cat VERSION) to ${{ inputs.TARGET_VERSION }}" | |
echo "${{ inputs.TARGET_VERSION }}" > VERSION | |
- name: Replace latest tag with version from input | |
run: | | |
set -ue | |
VERSION=${{ inputs.TARGET_VERSION }} make update-manifests-version | |
VERSION=${{ inputs.TARGET_VERSION }} make bump-chart | |
git diff | |
- name: Generate new set of manifests | |
run: | | |
set -ue | |
make k8s-manifests | |
git diff | |
- name: Create pull request | |
uses: peter-evans/[email protected] | |
with: | |
commit-message: "Bump version to ${{ inputs.TARGET_VERSION }}" | |
title: "Bump version to ${{ inputs.TARGET_VERSION }} on ${{ inputs.TARGET_BRANCH }} branch" | |
body: Updating VERSION and manifests to ${{ inputs.TARGET_VERSION }} | |
branch: update-version | |
branch-suffix: random | |
signoff: true | |
labels: release |