v11.21.1 #188
Workflow file for this run
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: Update Release Version | |
on: | |
release: | |
types: [released] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version that should be released' | |
required: true | |
default: '1.2.3' | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: 'main' | |
fetch-depth: 0 | |
- name: Version from Workflow Dispatch | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
V=$(echo ${{ github.event.inputs.version }} | sed 's/v//g') | |
echo "VERSION=${V}" >> $GITHUB_ENV | |
- name: Version from Release Tag | |
if: github.event_name == 'release' | |
run: | | |
V=$(echo ${{ github.event.release.tag_name }} | sed 's/v//g') | |
echo "VERSION=${V}" >> $GITHUB_ENV | |
- name: Verify valid version | |
id: vars | |
run: | | |
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Invalid version: $VERSION" | |
exit 1 | |
fi | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Commit VERSION file | |
run: | | |
echo ${VERSION} > VERSION | |
echo "VERSION is $VERSION" | |
git add VERSION | |
git config --global user.email "[email protected]" | |
git config --global user.name "Mondoo Tools" | |
git commit -m "Update VERSION to $VERSION" | |
git push -f |