Skip to content

Commit

Permalink
edit release guard checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sambles committed Nov 23, 2023
1 parent 7cd99c5 commit 6fbdfc9
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@ on:
prev_release_tag:
description: 'The last release, used for generating the changelog and release notes'
required: true
pre_release:
description: 'Mark GitHub release as pre-release: [true, false]'
required: true
default: 'false'

env:
RELEASE_TAG: ${{ inputs.release_tag }}
PREV_RELEASE_TAG: ${{ inputs.prev_release_tag }}
PRE_RELEASE: ${{ inputs.pre_release }}
PRE_RELEASE: 'false'
BUILD_SCRIPTS: "master" # build scripts branch


Expand Down Expand Up @@ -49,24 +45,16 @@ jobs:

steps:
# --- Release guards --- #
- name: is branch valid for release
if: ${{ !startsWith(github.ref_name , 'release/') && env.PRE_RELEASE == 'false' }}
run: |
echo "Releases must be trigged on branch named 'release/x.x.x'"
exit 1
#- name: is branch valid for release
# if: ${{ !startsWith(github.ref_name , 'release/') && env.PRE_RELEASE == 'false' }}
# run: |
# echo "Releases must be trigged on branch named 'release/x.x.x'"
# exit 1

- name: Check tag is valid for release
if: env.PRE_RELEASE == 'false'
run: |
VALID=$(echo ${{ env.RELEASE_TAG }} | grep -oPc "^(\d+)\.(\d+)\.(\d+)$")
if [[ ! "$VALID" == 1 ]]; then
echo "Release Tag ${{ env.RELEASE_TAG }} is not valid"
exit 1
fi
- name: Check tag is valid for pre-release
if: env.PRE_RELEASE == 'true'
run: |
VALID=$(echo ${{ env.RELEASE_TAG }} | grep -oPc "^(\d+)\.(\d+)\.(\d+)rc(\d+)$")
VALID=$(echo ${{ env.RELEASE_TAG }} | grep -oPc "^1.11.1*")
if [[ ! "$VALID" == 1 ]]; then
echo "Release Tag ${{ env.RELEASE_TAG }} is not valid"
exit 1
Expand Down

0 comments on commit 6fbdfc9

Please sign in to comment.