diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 724f50ab..043c041a 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -38,19 +38,24 @@ jobs: run: | API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY" TAG="$GITHUB_REF_NAME" - # Create release (idempotent) + echo "Creating release for $TAG..." curl -sf -X POST "$API/releases" \ -H "Authorization: token $RELEASE_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \ - -H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) + -H "Authorization: token $RELEASE_TOKEN" | jq -r '.id') + if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then + echo "ERROR: Failed to get release ID for $TAG" + exit 1 + fi echo "Release ID: $RELEASE_ID" find src-tauri/target/x86_64-unknown-linux-gnu/release/bundle \ \( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) | while read f; do + echo "Uploading $(basename $f)..." curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \ -H "Authorization: token $RELEASE_TOKEN" \ - -F "attachment=@$f;filename=$(basename $f)" && echo "Uploaded $(basename $f)" || echo "Upload failed: $f" + -F "attachment=@$f;filename=$(basename $f)" && echo "✓ Uploaded $(basename $f)" || echo "✗ Upload failed: $f" done build-windows-amd64: @@ -87,17 +92,24 @@ jobs: run: | API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY" TAG="$GITHUB_REF_NAME" + echo "Creating release for $TAG..." curl -sf -X POST "$API/releases" \ -H "Authorization: token $RELEASE_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \ - -H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) + -H "Authorization: token $RELEASE_TOKEN" | jq -r '.id') + if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then + echo "ERROR: Failed to get release ID for $TAG" + exit 1 + fi + echo "Release ID: $RELEASE_ID" find src-tauri/target/x86_64-pc-windows-gnu/release/bundle \ \( -name "*.exe" -o -name "*.msi" \) 2>/dev/null | while read f; do + echo "Uploading $(basename $f)..." curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \ -H "Authorization: token $RELEASE_TOKEN" \ - -F "attachment=@$f;filename=$(basename $f)" && echo "Uploaded $(basename $f)" || echo "Upload failed: $f" + -F "attachment=@$f;filename=$(basename $f)" && echo "✓ Uploaded $(basename $f)" || echo "✗ Upload failed: $f" done build-macos-arm64: @@ -131,17 +143,28 @@ jobs: run: | API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY" TAG="$GITHUB_REF_NAME" + # Create release (idempotent) + echo "Creating release for $TAG..." curl -sf -X POST "$API/releases" \ -H "Authorization: token $RELEASE_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true + # Get release ID RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \ - -H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) + -H "Authorization: token $RELEASE_TOKEN" | jq -r '.id') + if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then + echo "ERROR: Failed to get release ID for $TAG" + echo "Attempting to list recent releases..." + curl -sf "$API/releases" -H "Authorization: token $RELEASE_TOKEN" | jq -r '.[] | "\(.tag_name): \(.id)"' | head -5 + exit 1 + fi echo "Release ID: $RELEASE_ID" + # Upload DMG find src-tauri/target/aarch64-apple-darwin/release/bundle -name "*.dmg" | while read f; do + echo "Uploading $(basename $f)..." curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \ -H "Authorization: token $RELEASE_TOKEN" \ - -F "attachment=@$f;filename=$(basename $f)" && echo "Uploaded $(basename $f)" || echo "Upload failed: $f" + -F "attachment=@$f;filename=$(basename $f)" && echo "✓ Uploaded $(basename $f)" || echo "✗ Upload failed: $f" done build-linux-arm64: @@ -177,15 +200,22 @@ jobs: run: | API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY" TAG="$GITHUB_REF_NAME" + echo "Creating release for $TAG..." curl -sf -X POST "$API/releases" \ -H "Authorization: token $RELEASE_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \ - -H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) + -H "Authorization: token $RELEASE_TOKEN" | jq -r '.id') + if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then + echo "ERROR: Failed to get release ID for $TAG" + exit 1 + fi + echo "Release ID: $RELEASE_ID" find src-tauri/target/aarch64-unknown-linux-gnu/release/bundle \ \( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) | while read f; do + echo "Uploading $(basename $f)..." curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \ -H "Authorization: token $RELEASE_TOKEN" \ - -F "attachment=@$f;filename=$(basename $f)" && echo "Uploaded $(basename $f)" || echo "Upload failed: $f" + -F "attachment=@$f;filename=$(basename $f)" && echo "✓ Uploaded $(basename $f)" || echo "✗ Upload failed: $f" done