Test wget
Some checks failed
release / build (push) Failing after 2m59s

This commit is contained in:
Jared Miller 2025-12-20 12:07:35 -05:00
parent e4115f101c
commit 8ad189f9a3
No known key found for this signature in database

View file

@ -50,38 +50,28 @@ jobs:
echo "Token length: ${#FORGEJO_TOKEN}"
TAG="${{ github.event.inputs.tag || github.ref_name }}"
# use internal docker network URL instead of external
API_BASE="http://forgejo:3000/api/v1"
API_BASE="${{ github.server_url }}/api/v1"
REPO="${{ github.repository }}"
# ensure tag exists (create at HEAD if not)
curl -s -X POST \
-H "Authorization: token ${FORGEJO_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"${TAG}\"}" \
"${API_BASE}/repos/${REPO}/tags" || true
# get or create release
echo "Looking for release: ${API_BASE}/repos/${REPO}/releases/tags/${TAG}"
RESPONSE=$(curl -s -H "Authorization: token ${FORGEJO_TOKEN}" \
"${API_BASE}/repos/${REPO}/releases/tags/${TAG}")
RESPONSE=$(wget -qO- --header="Authorization: token ${FORGEJO_TOKEN}" \
"${API_BASE}/repos/${REPO}/releases/tags/${TAG}" 2>/dev/null || echo '{}')
echo "Lookup response: ${RESPONSE}"
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id // empty')
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
if [ -z "$RELEASE_ID" ]; then
echo "Creating release for ${TAG}..."
RESPONSE=$(curl -s -X POST \
-H "Content-Type: application/json" \
-H "Authorization: token ${FORGEJO_TOKEN}" \
-d '{"tag_name": "'"${TAG}"'", "name": "'"${TAG}"'"}' \
"${API_BASE}/repos/${REPO}/releases")
RESPONSE=$(wget -qO- --header="Authorization: token ${FORGEJO_TOKEN}" \
--header="Content-Type: application/json" \
--post-data='{"tag_name": "'"${TAG}"'", "name": "'"${TAG}"'"}' \
"${API_BASE}/repos/${REPO}/releases" 2>&1)
echo "Create response: ${RESPONSE}"
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
fi
echo "Release ID: ${RELEASE_ID}"
# upload assets
# upload assets (still need curl for multipart)
for file in lofivor-linux-x86_64 lofivor-windows-x86_64.exe; do
echo "Uploading $file..."
curl -sf -X POST \