From 067415e757465581332863716e02cab88c02586b Mon Sep 17 00:00:00 2001 From: Chris Aslanoglou Date: Tue, 19 Sep 2023 14:21:48 +0300 Subject: [PATCH] chore(release): check tag name and print if erroneous [no-jira] --- .github/workflows/release.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 315455f..4825683 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,8 +13,17 @@ jobs: with: ref: ${{ github.ref }} + - name: Check tag name pattern follows `vX.Y.Z` + run: | + if [[ ! "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Tag name ($GITHUB_REF) does not match the pattern 'vX.Y.Z'. Exiting." + exit 0 + fi + - name: Issue a release only if a tag is based on a merged commit in `main` branch run: | + git fetch main + tag_commit=$(git rev-parse ${{ github.ref }}) merged_commit=$(git rev-parse main) @@ -25,13 +34,6 @@ jobs: exit 0 fi - - name: Check tag name pattern follows `vX.Y.Z` - run: | - if [[ ! "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "Tag name does not match the pattern 'vX.Y.Z'. Exiting." - exit 0 - fi - - name: Setup Java uses: actions/setup-java@v3 with: