Modify bb64/publish.sh
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 24s
Build-Test-Publish / build (linux/arm64) (push) Failing after 27s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Has been skipped
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Has been skipped

This commit is contained in:
Your Name 2025-06-25 22:01:56 +12:00
parent 44d4af498f
commit abcd1c07c3

View File

@ -77,34 +77,52 @@ if [ -z "$DOCKER_PUSH_TOKEN" ]; then
exit 1 exit 1
fi 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 "Content-Type: application/json" \
-H "Authorization: token $DOCKER_PUSH_TOKEN" \ -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 if [ -z "$RELEASE_ID" ]; then
echo "Failed to create release on Gitea." >&2 echo "Failed to create release on Gitea." >&2
echo "API URL: $API_URL/releases" >&2
echo "Release data: $RELEASE_DATA" >&2
exit 1 exit 1
fi fi
echo "Created release with ID: $RELEASE_ID"
# Upload binaries and install.sh # Upload binaries and install.sh
echo "Uploading assets to release..."
for FILE in ${PROJECT}.${ARCH_ALIAS} ${PROJECT}.${ARCH} install.sh; do for FILE in ${PROJECT}.${ARCH_ALIAS} ${PROJECT}.${ARCH} install.sh; do
if [ -f "output/$FILE" ]; then if [ -f "output/$FILE" ]; then
filetoupload="output/$FILE" filetoupload="output/$FILE"
elif [ -f "$FILE" ]; then elif [ -f "$FILE" ]; then
filetoupload="$FILE" filetoupload="$FILE"
else else
echo "Skipping $FILE - not found"
continue continue
fi fi
echo "Uploading $filetoupload as $FILE..."
# Auto-detect content type # Auto-detect content type
ctype=$(file --mime-type -b "$filetoupload") 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 "Content-Type: $ctype" \
-H "Authorization: token $DOCKER_PUSH_TOKEN" \ -H "Authorization: token $DOCKER_PUSH_TOKEN" \
--data-binary @"$filetoupload" --data-binary @"$filetoupload")
echo "Uploaded $FILE to release $TAG as $ctype."
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 done
echo "Published bb64 version $v to $REPO_URL (tag $TAG) with binaries for $ARCH_ALIAS / $ARCH." 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 fi
if [ -f "$GETPKG" ]; then 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 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 fi
echo "✓ BB64 publish script completed successfully"