From 3e1edb1637eebe63b3a6902028aef89689e537de Mon Sep 17 00:00:00 2001 From: Toaster Date: Tue, 8 Sep 2026 15:52:04 +0000 Subject: [PATCH] Update .gitea/workflows/build-android.yaml --- .gitea/workflows/build-android.yaml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/build-android.yaml b/.gitea/workflows/build-android.yaml index eaee998efb..9db5f2cd7a 100644 --- a/.gitea/workflows/build-android.yaml +++ b/.gitea/workflows/build-android.yaml @@ -98,6 +98,7 @@ jobs: } } EOF +est release yet on the first run. But the very next line kills the whole script: - name: Run EAS Local Build env: @@ -124,38 +125,45 @@ jobs: TAG="latest" - EXISTING_RELEASE=$(curl -sS -w "\nHTTP_STATUS:%{http_code}" \ + EXISTING_RELEASE=$(curl -sS \ -H "Authorization: token $GITEA_TOKEN" \ "$GITEA_API/repos/$REPO/releases/tags/$TAG") echo "Existing release lookup response: $EXISTING_RELEASE" - EXISTING_ID=$(echo "$EXISTING_RELEASE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') + EXISTING_ID=$(echo "$EXISTING_RELEASE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*' || true) if [ -n "$EXISTING_ID" ]; then echo "Deleting existing release ID: $EXISTING_ID" - curl -sS -w "\nHTTP_STATUS:%{http_code}" -X DELETE \ + curl -sS -X DELETE \ -H "Authorization: token $GITEA_TOKEN" \ "$GITEA_API/repos/$REPO/releases/$EXISTING_ID" + else + echo "No existing release found, skipping delete" fi - echo "Deleting old tag..." - curl -sS -w "\nHTTP_STATUS:%{http_code}" -X DELETE \ + echo "Deleting old tag (if any)..." + curl -sS -X DELETE \ -H "Authorization: token $GITEA_TOKEN" \ - "$GITEA_API/repos/$REPO/tags/$TAG" + "$GITEA_API/repos/$REPO/tags/$TAG" || true echo "Creating new release..." - RELEASE_RESPONSE=$(curl -sS -w "\nHTTP_STATUS:%{http_code}" -X POST \ + RELEASE_RESPONSE=$(curl -sS -X POST \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"tag_name\": \"$TAG\", \"name\": \"Latest Build\", \"body\": \"Automated build from commit ${{ github.sha }}\", \"draft\": false, \"prerelease\": false}" \ "$GITEA_API/repos/$REPO/releases") echo "Create release response: $RELEASE_RESPONSE" - RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') + RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*' || true) echo "Created release ID: $RELEASE_ID" + if [ -z "$RELEASE_ID" ]; then + echo "Failed to create release, aborting" + exit 1 + fi + echo "Uploading APK..." - curl -sS -w "\nHTTP_STATUS:%{http_code}" -X POST \ + curl -sS -X POST \ -H "Authorization: token $GITEA_TOKEN" \ -F "attachment=@bluesky-custom.apk" \ "$GITEA_API/repos/$REPO/releases/$RELEASE_ID/assets?name=bluesky-custom.apk" \ No newline at end of file