diff --git a/bb64/publish.sh b/bb64/publish.sh index f914d87..9c8ac38 100755 --- a/bb64/publish.sh +++ b/bb64/publish.sh @@ -77,6 +77,23 @@ if [ -z "$RELEASE_WRITE_TOKEN" ]; then exit 1 fi +# Create and push git tag +echo "Creating git tag $TAG..." +# Check if tag already exists +if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "Tag $TAG already exists, deleting it first..." + git tag -d "$TAG" + git push origin --delete "$TAG" || true +fi + +git tag -a "$TAG" -m "Release $TAG" +if ! git push origin "$TAG"; then + echo "Failed to push tag $TAG to origin" >&2 + # Try to delete local tag if push failed + git tag -d "$TAG" + exit 1 +fi + echo "Creating release $TAG on Gitea..." RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \ -H "Content-Type: application/json" \