From 4987189758a2dcb5c7c5353367c9e4c1fb7c9a28 Mon Sep 17 00:00:00 2001 From: David Lukac <1215290+davidlukac@users.noreply.github.com> Date: Sat, 28 Aug 2021 01:16:52 +0200 Subject: [PATCH] Feature/7 move snapshot tag (#32) * [#7] Move snapshot tag dynamically --- .github/workflows/cicd.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index ae0b7e7..1f7f615 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -20,6 +20,27 @@ jobs: with: env-file: .env + - name: Move snapshot tag + uses: actions/github-script@v4 + with: + script: | + try { + await github.git.deleteRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: "tags/v${{ env.APP_VERSION }}-snapshot" + }) + } catch (e) { + console.log("The snapshot tag doesn't exist yet: " + e) + } + await github.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: "refs/tags/v${{ env.APP_VERSION }}-snapshot", + sha: context.sha + }) + if: github.ref == 'refs/heads/master' + - name: GoLang setup uses: actions/setup-go@v2 with: