From 8bbd97d69caca5a81ee479322cf541ccf85ac954 Mon Sep 17 00:00:00 2001 From: Brett Kyle Date: Wed, 22 Jan 2025 22:06:28 +0000 Subject: [PATCH] --fixup reinstate tag --- .../workflows/publish-release-to-github.yaml | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-release-to-github.yaml b/.github/workflows/publish-release-to-github.yaml index f9e7c863a6..82e14b0648 100644 --- a/.github/workflows/publish-release-to-github.yaml +++ b/.github/workflows/publish-release-to-github.yaml @@ -30,15 +30,25 @@ jobs: git config user.name 'github-actions[bot]' git config user.email 'github-actions[bot]@users.noreply.github.com' - - name: Get current version - id: get-version + - name: Create GitHub tag + id: create-github-tag run: | ALL_PACKAGE_VERSION=$(npm run version --silent --workspace govuk-frontend) TAG="v5.8.1-internal.0" - echo "GH_TAG=${TAG}" >> $GITHUB_OUTPUT + + if [ $(git tag -l "$TAG") ]; then + echo "⚠️ Tag $TAG already exists. Please delete $TAG via the GitHub UI and re-run this workflow" + exit 1 + else + echo "🗒 Tagging repo using tag version: $TAG ..." + git tag -a $TAG -m "GOV.UK Frontend release $TAG" + git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} --tags + echo "🗒 Tag $TAG created and pushed to remote." + echo "GH_TAG=${TAG}" >> $GITHUB_OUTPUT + fi - name: Create GitHub archive - run: git archive -o ./release-${{ steps.get-version.outputs.GH_TAG }}.zip HEAD:dist + run: git archive -o ./release-${{ steps.create-github-tag.outputs.GH_TAG }}.zip HEAD:dist - name: Generate release notes uses: actions/github-script@v7.0.1 @@ -50,7 +60,7 @@ jobs: - name: Create GitHub release run: | - GH_TAG=${{ steps.get-version.outputs.GH_TAG }} + GH_TAG=${{ steps.create-github-tag.outputs.GH_TAG }} RELEASE_NAME="GOV.UK Frontend $GH_TAG" RELEASE_BODY=$(cat release-notes-body)