Start Release #13
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: Start Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Override Version' | |
required: false | |
default: '' # default to current version | |
env: | |
git_user: duplo-bot | |
git_email: [email protected] | |
jobs: | |
start-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: develop # Always release from develop | |
fetch-depth: 0 | |
persist-credentials: false # Needed so we can push with different credentials. | |
# NOTE: Pushing with different credentials allows admins to push protected branches. | |
# NOTE: Pushing with different credentials allow workflows to trigger from the push. | |
# GET THE RELEASE VERSION | |
- name: Get release version | |
id: version | |
run: | | |
# Fail on errors | |
set -euo pipefail | |
# Use the current version if it is not being overridden | |
if [ -z "${{ github.event.inputs.version }}" ]; then | |
echo "release=$(sed -ne 's/^VERSION=\([0-9\.]*\).*$/\1/p' <Makefile)" >>$GITHUB_OUTPUT | |
# Otherwise, the use the overridden version. | |
else | |
echo "release=${{ github.event.inputs.version }}" >>$GITHUB_OUTPUT | |
fi | |
# START THE RELEASE | |
- name: Initialize mandatory git config | |
run: | | |
git config --global user.name $git_user && | |
git config --global user.email $git_email | |
- name: Start gitflow release | |
uses: duplocloud/ghactions-start-gitflow-release@master | |
with: | |
github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | |
version: "${{ steps.version.outputs.release }}" | |
precommit_run: | | |
# Fail on errors | |
set -euo pipefail | |
if [ -z "${{ github.event.inputs.version }}" ]; then | |
RELEASE_VERSION="${{ steps.version.outputs.release }}" | |
sed -e 's/^\(VERSION=\)[0-9\.]*/\1'"$RELEASE_VERSION"'/g' -i Makefile | |
fi |