From 8c8eb9aff96f947536203829939f63202564232d Mon Sep 17 00:00:00 2001 From: Pavel Kotelevsky Date: Mon, 13 Nov 2023 15:30:29 +0100 Subject: [PATCH] build: fix tag not found on release --- .github/workflows/RELEASE.yaml | 47 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/.github/workflows/RELEASE.yaml b/.github/workflows/RELEASE.yaml index 10ca57943e..4dae9499e4 100644 --- a/.github/workflows/RELEASE.yaml +++ b/.github/workflows/RELEASE.yaml @@ -15,6 +15,30 @@ jobs: ref: ${{ github.event.release.target_commitish }} fetch-depth: 0 + - name: Check if new version implies pre-release + id: check_prerelease + run: | + if [[ ${{github.event.release.prerelease}} == "true" ]]; then + PRE_RELEASE=true + elif [[ ${{ github.event.release.tag_name }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + PRE_RELEASE=false + else + PRE_RELEASE=true + fi + echo "isPreRelease=${PRE_RELEASE}" >> $GITHUB_OUTPUT + + - name: Get previous tag for changelog + id: get_previous_tag + run: | + git pull --tags + if [[ ${{steps.check_prerelease.outputs.isPreRelease}} == "true" ]]; then + TAG_NAME=$(git --no-pager tag --sort=-creatordate | head -2 | tail -1) + else + TAG_NAME=$(git --no-pager tag --sort=-creatordate | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -2 | tail -1) + fi + echo "previousTag: $TAG_NAME" + echo "previousTag=${TAG_NAME}" >> $GITHUB_OUTPUT + - name: Import Secrets id: secrets uses: hashicorp/vault-action@v2.7.4 @@ -83,29 +107,6 @@ jobs: - name: Install element templates CLI run: npm install --global element-templates-cli - - name: Check if new version implies pre-release - id: check_prerelease - run: | - if [[ ${{github.event.release.prerelease}} == "true" ]]; then - PRE_RELEASE=true - elif [[ ${{ github.event.release.tag_name }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - PRE_RELEASE=false - else - PRE_RELEASE=true - fi - echo "isPreRelease=${PRE_RELEASE}" >> $GITHUB_OUTPUT - - - name: Get previous tag for changelog - id: get_previous_tag - run: | - if [[ ${{steps.check_prerelease.outputs.isPreRelease}} == "true" ]]; then - TAG_NAME=$(git --no-pager tag --sort=-creatordate | head -2 | tail -1) - else - TAG_NAME=$(git --no-pager tag --sort=-creatordate | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -2 | tail -1) - fi - echo "previousTag: $TAG_NAME" - echo "previousTag=${TAG_NAME}" >> $GITHUB_OUTPUT - # Maven build & version bump - name: Set Connectors release version