Skip to content

Commit 9aa9b5b

Browse files
Copilotfriggeri
andcommitted
Simplify Go tag creation logic
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
1 parent 25540c9 commit 9aa9b5b

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,12 @@ 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-
# 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
218-
echo "Tag $TAG_NAME already exists, skipping"
216+
# Try to create the tag - will fail if it already exists
217+
if git tag "$TAG_NAME" 2>/dev/null; then
218+
git push origin "$TAG_NAME"
219+
echo "Created and pushed tag $TAG_NAME"
219220
else
220-
git 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
221+
echo "Tag $TAG_NAME already exists, skipping"
228222
fi
229223
env:
230224
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)