From 0416c5918a2b9cc3a78acecc2ec583d939b7767f Mon Sep 17 00:00:00 2001
From: "ricky.gummadi" <ricky.gummadi>
Date: Mon, 1 Jul 2024 17:00:17 +1200
Subject: [PATCH] udpated workflow to tag after successful build and test

---
 .github/workflows/build-and-deploy.yml | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml
index c3aef45..742271f 100644
--- a/.github/workflows/build-and-deploy.yml
+++ b/.github/workflows/build-and-deploy.yml
@@ -24,9 +24,8 @@ jobs:
       - name: Run Linter
         run: npm run lint
 
-      - name: Tag the release
-        id: tag_version
-        if: github.ref == 'refs/heads/dev'
+      - name: Determine the version
+        id: determine_version
         run: |
           git config --global user.email "github-actions[bot]@users.noreply.github.com"
           git config --global user.name "github-actions[bot]"
@@ -65,10 +64,6 @@ jobs:
             fi
           fi
           
-          # Create and push the new tag
-          git tag $NEW_TAG
-          git push origin $NEW_TAG
-          
           # Set the new tag as an environment variable
           echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
 
@@ -82,6 +77,16 @@ jobs:
         env:
           NEW_TAG: ${{ env.NEW_TAG }}
 
+      - name: Tag the release
+        if: github.ref == 'refs/heads/dev'
+        run: |
+          git config --global user.email "github-actions[bot]@users.noreply.github.com"
+          git config --global user.name "github-actions[bot]"
+          
+          # Create and push the new tag
+          git tag ${{ env.NEW_TAG }}
+          git push origin ${{ env.NEW_TAG }}
+
       - name: Deploy to GitHub Pages
         uses: peaceiris/actions-gh-pages@v3
         with: