From abcd1c07c34ca0106a62fa3d4cec606a9516d6a2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 25 Jun 2025 22:01:56 +1200 Subject: [PATCH] Modify bb64/publish.sh --- bb64/publish.sh | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/bb64/publish.sh b/bb64/publish.sh index 5321f83..14d41ef 100755 --- a/bb64/publish.sh +++ b/bb64/publish.sh @@ -77,34 +77,52 @@ if [ -z "$DOCKER_PUSH_TOKEN" ]; then exit 1 fi -RELEASE_ID=$(curl -s -X POST "$API_URL/releases" \ +echo "Creating release $TAG on Gitea..." +RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \ -H "Content-Type: application/json" \ -H "Authorization: token $DOCKER_PUSH_TOKEN" \ - -d "$RELEASE_DATA" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) + -d "$RELEASE_DATA") + +echo "Release API response: $RELEASE_RESPONSE" + +RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) if [ -z "$RELEASE_ID" ]; then echo "Failed to create release on Gitea." >&2 + echo "API URL: $API_URL/releases" >&2 + echo "Release data: $RELEASE_DATA" >&2 exit 1 fi +echo "Created release with ID: $RELEASE_ID" + # Upload binaries and install.sh +echo "Uploading assets to release..." for FILE in ${PROJECT}.${ARCH_ALIAS} ${PROJECT}.${ARCH} install.sh; do if [ -f "output/$FILE" ]; then filetoupload="output/$FILE" elif [ -f "$FILE" ]; then filetoupload="$FILE" else + echo "Skipping $FILE - not found" continue fi + echo "Uploading $filetoupload as $FILE..." # Auto-detect content type ctype=$(file --mime-type -b "$filetoupload") - curl -s -X POST "$API_URL/releases/$RELEASE_ID/assets?name=$FILE" \ + UPLOAD_RESPONSE=$(curl -s -X POST "$API_URL/releases/$RELEASE_ID/assets?name=$FILE" \ -H "Content-Type: $ctype" \ -H "Authorization: token $DOCKER_PUSH_TOKEN" \ - --data-binary @"$filetoupload" - echo "Uploaded $FILE to release $TAG as $ctype." + --data-binary @"$filetoupload") + + if echo "$UPLOAD_RESPONSE" | grep -q '"id"'; then + echo "✓ Uploaded $FILE to release $TAG as $ctype." + else + echo "✗ Failed to upload $FILE. Response: $UPLOAD_RESPONSE" >&2 + exit 1 + fi done echo "Published bb64 version $v to $REPO_URL (tag $TAG) with binaries for $ARCH_ALIAS / $ARCH." @@ -125,7 +143,15 @@ if [ ! -f "$GETPKG" ]; then fi if [ -f "$GETPKG" ]; then - "${GETPKG}" publish "${PROJECT}:${ARCH}" "${TOOLDIR}" + echo "Publishing ${PROJECT} to getpkg.xyz using ${GETPKG}..." + if "${GETPKG}" publish "${PROJECT}:${ARCH}" "${TOOLDIR}"; then + echo "✓ Successfully published ${PROJECT} to getpkg.xyz" + else + echo "✗ Failed to publish ${PROJECT} to getpkg.xyz" >&2 + exit 1 + fi else - echo "Warning: getpkg not found, skipping tool publishing to getpkg.xyz" + echo "Warning: getpkg not found at $GETPKG, skipping tool publishing to getpkg.xyz" fi + +echo "✓ BB64 publish script completed successfully"