File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,12 +213,18 @@ jobs:
213213 git config user.email "github-actions[bot]@users.noreply.github.com"
214214 git fetch --tags
215215 TAG_NAME="go/v${{ needs.version.outputs.version }}"
216- if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
216+ # Check if tag exists locally or remotely
217+ if git rev-parse "$TAG_NAME" >/dev/null 2>&1 || git ls-remote --tags origin "refs/tags/$TAG_NAME" | grep -q "$TAG_NAME"; then
217218 echo "Tag $TAG_NAME already exists, skipping"
218219 else
219220 git tag "$TAG_NAME"
220- git push origin "$TAG_NAME"
221- echo "Created and pushed tag $TAG_NAME"
221+ if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
222+ git push origin "$TAG_NAME"
223+ echo "Created and pushed tag $TAG_NAME"
224+ else
225+ echo "Failed to create tag $TAG_NAME"
226+ exit 1
227+ fi
222228 fi
223229 env :
224230 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments