Skip to content

Commit 2bf39cf

Browse files
committed
ci: allow tag push failures to fall back to existing tag
1 parent ae0b519 commit 2bf39cf

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/cli-release-staging.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,22 @@ jobs:
134134
135135
git tag "$TAG"
136136
137-
if git push origin "$TAG"; then
138-
echo "Pushed tag $TAG to origin."
139-
exit 0
140-
fi
141-
142-
echo "Push failed, re-checking remote for $TAG..."
143-
if git ls-remote --tags origin "$TAG" | grep -q "$TAG"; then
144-
echo "Tag $TAG is present on origin after push attempt; continuing."
145-
exit 0
137+
set +e
138+
git push origin "$TAG"
139+
PUSH_STATUS=$?
140+
set -e
141+
142+
if [ "$PUSH_STATUS" -ne 0 ]; then
143+
echo "Push failed, re-checking remote for $TAG..."
144+
if git ls-remote --tags origin "$TAG" | grep -q "$TAG"; then
145+
echo "Tag $TAG is present on origin after push attempt; continuing."
146+
exit 0
147+
fi
148+
echo "Failed to push tag $TAG and it is not present on origin."
149+
exit 1
146150
fi
147151
148-
echo "Failed to push tag $TAG and it is not present on origin."
149-
exit 1
152+
echo "Pushed tag $TAG to origin."
150153
151154
- name: Upload staging metadata
152155
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)