fix(ci): delete and recreate tag ref to move latest-main to correct commit
CI / Build & Test (push) Successful in 1m36s

Made-with: Cursor
This commit is contained in:
Raven Scott
2026-02-27 18:55:55 -05:00
parent 3db2db36db
commit 600342e965
+13 -14
View File
@@ -136,21 +136,20 @@ jobs:
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
AUTH="Authorization: token ${{ secrets.RELEASE_TOKEN }}"
# Force-move the git tag to the current commit
# Try to update existing ref first, create if it doesn't exist
UPDATE=$(curl -s -o /dev/null -w "%{http_code}" -X PATCH \
-H "$AUTH" -H "Content-Type: application/json" \
"${API}/git/refs/tags/${TAG}" \
-d "{\"sha\": \"${{ github.sha }}\", \"force\": true}")
echo "Tag update HTTP: $UPDATE"
# Force-move the git tag to the current commit.
# Delete the old tag ref first, then recreate it pointing at the new SHA.
echo "Deleting old tag ref ${TAG}..."
curl -s -X DELETE \
-H "$AUTH" \
"${API}/git/refs/tags/${TAG}" || true
if [ "$UPDATE" != "200" ]; then
echo "Tag doesn't exist yet, creating..."
curl -s -X POST \
-H "$AUTH" -H "Content-Type: application/json" \
"${API}/git/refs" \
-d "{\"ref\": \"refs/tags/${TAG}\", \"sha\": \"${{ github.sha }}\"}"
fi
sleep 1
echo "Creating tag ref ${TAG} at ${{ github.sha }}..."
curl -s -X POST \
-H "$AUTH" -H "Content-Type: application/json" \
"${API}/git/refs" \
-d "{\"ref\": \"refs/tags/${TAG}\", \"sha\": \"${{ github.sha }}\"}"
# Get existing release by tag (if any)
EXISTING=$(curl -s -H "$AUTH" "${API}/releases/tags/${TAG}")