Modify bb64/publish.sh
This commit is contained in:
@ -105,12 +105,20 @@ echo "Getting or creating release $TAG on Gitea..."
|
|||||||
EXISTING_RELEASE=$(curl -s -X GET "$API_URL/releases/tags/$TAG" \
|
EXISTING_RELEASE=$(curl -s -X GET "$API_URL/releases/tags/$TAG" \
|
||||||
-H "Authorization: token $RELEASE_WRITE_TOKEN")
|
-H "Authorization: token $RELEASE_WRITE_TOKEN")
|
||||||
|
|
||||||
|
echo "Existing release check response: $EXISTING_RELEASE" >&2
|
||||||
|
|
||||||
if echo "$EXISTING_RELEASE" | grep -q '"id":[0-9]*'; then
|
if echo "$EXISTING_RELEASE" | grep -q '"id":[0-9]*'; then
|
||||||
# Release already exists, get its ID
|
# Release already exists, get its ID
|
||||||
RELEASE_ID=$(echo "$EXISTING_RELEASE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
RELEASE_ID=$(echo "$EXISTING_RELEASE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
echo "Release $TAG already exists with ID: $RELEASE_ID"
|
echo "Release $TAG already exists with ID: $RELEASE_ID"
|
||||||
else
|
else
|
||||||
# Create new release
|
# Create new release only if tag was just created
|
||||||
|
if [ "$TAG_EXISTS_ON_REMOTE" = true ]; then
|
||||||
|
echo "Tag exists on remote but no release found - this shouldn't happen" >&2
|
||||||
|
echo "API response was: $EXISTING_RELEASE" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Creating new release $TAG on Gitea..."
|
echo "Creating new release $TAG on Gitea..."
|
||||||
RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \
|
RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
|
Reference in New Issue
Block a user