From 402d6b5bf8349f8030184a3db6fd79ba2d5a19d0 Mon Sep 17 00:00:00 2001 From: Marcin Bator Date: Tue, 3 Dec 2024 18:17:50 +0100 Subject: [PATCH] fix: #dev-deploy tag fix 7 --- .github/workflows/dev.kodemy.deploy.yml | 30 ++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dev.kodemy.deploy.yml b/.github/workflows/dev.kodemy.deploy.yml index 825f279..c86afd2 100644 --- a/.github/workflows/dev.kodemy.deploy.yml +++ b/.github/workflows/dev.kodemy.deploy.yml @@ -191,24 +191,28 @@ jobs: name: Create tag runs-on: self-hosted steps: - - name: Set Dist Version + - name: Determine new tag + id: tag run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "${BUILD_NUMBER}" - VERSION=$(echo $last_tag | awk -F. '{printf "v%d.%d.%d", $1, $2+1, 0}') - echo "DIST_VERSION=${VERSION}" >> $GITHUB_ENV + last_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") + echo "Last tag: $last_tag" - - name: Create Tag - uses: actions/github-script@v6 + new_tag=$(echo $last_tag | awk -F. '{printf "v%d.%d.%d", $1, $2+1, 0}') + echo "New tag: $new_tag" + + echo "TAG_NAME=$new_tag" >> $GITHUB_ENV + + - name: Create tag + uses: actions/github-script@v5 with: script: | - const {DIST_VERSION} = process.env github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/tags/${{ env.TAG_NAME }}`, + sha: context.sha + }); +