From 227afb37b243ede30403a924c85bb92caa2cd028 Mon Sep 17 00:00:00 2001 From: szapp Date: Thu, 5 Sep 2024 18:57:19 +0200 Subject: [PATCH] Add safety check in workflow for version numbers --- .github/workflows/release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6fa471..00807f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,12 +42,16 @@ jobs: if [ "${{ github.event.inputs.increase-major }}" == "Yes" ]; then VMAJOR=$[$VMAJOR+1] echo "Increase major version to $VMAJOR" + if [ $VMAJOR -gt 9 ]; then + echo "::error title=Invalid version::The major version needs to be one digit!" + exit 1 + fi fi echo "VMAJOR=$VMAJOR" >> $GITHUB_ENV - name: Bump version number and release years run: | sed -i -r "s/(^export RYEARS=[0-9]{4}-)[0-9]{4}$/\1$(date +'%Y')/" metadata - sed -i -r "s/(^export VMAJOR=)[0-9]+$/\1${{ env.VMAJOR }}/" metadata + sed -i -r "s/(^export VMAJOR=)-?[0-9]+$/\1${{ env.VMAJOR }}/" metadata sed -i -r "s/(^export VMINOR=)[0-9]+$/\1${{ env.VMINOR }}/" metadata sed -i -r "s/(^export IKARUS_VERSION=)[0-9]+$/\1${{ env.VIKARUS_NEW }}/" metadata sed -i -r "s/(^export LEGO_N_VERSION=)[0-9]+$/\1${{ env.VLEGO_NEW }}/" metadata