Update .gitea/workflows/build-android.yaml
Build Custom Bluesky APK / build-android (push) Successful in 8m3s

This commit is contained in:
2026-09-08 15:52:04 +00:00
parent 6320074cfc
commit 3e1edb1637
+17 -9
View File
@@ -98,6 +98,7 @@ jobs:
} }
} }
EOF EOF
est release yet on the first run. But the very next line kills the whole script:
- name: Run EAS Local Build - name: Run EAS Local Build
env: env:
@@ -124,38 +125,45 @@ jobs:
TAG="latest" TAG="latest"
EXISTING_RELEASE=$(curl -sS -w "\nHTTP_STATUS:%{http_code}" \ EXISTING_RELEASE=$(curl -sS \
-H "Authorization: token $GITEA_TOKEN" \ -H "Authorization: token $GITEA_TOKEN" \
"$GITEA_API/repos/$REPO/releases/tags/$TAG") "$GITEA_API/repos/$REPO/releases/tags/$TAG")
echo "Existing release lookup response: $EXISTING_RELEASE" 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 if [ -n "$EXISTING_ID" ]; then
echo "Deleting existing release ID: $EXISTING_ID" 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" \ -H "Authorization: token $GITEA_TOKEN" \
"$GITEA_API/repos/$REPO/releases/$EXISTING_ID" "$GITEA_API/repos/$REPO/releases/$EXISTING_ID"
else
echo "No existing release found, skipping delete"
fi fi
echo "Deleting old tag..." echo "Deleting old tag (if any)..."
curl -sS -w "\nHTTP_STATUS:%{http_code}" -X DELETE \ curl -sS -X DELETE \
-H "Authorization: token $GITEA_TOKEN" \ -H "Authorization: token $GITEA_TOKEN" \
"$GITEA_API/repos/$REPO/tags/$TAG" "$GITEA_API/repos/$REPO/tags/$TAG" || true
echo "Creating new release..." 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 "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{\"tag_name\": \"$TAG\", \"name\": \"Latest Build\", \"body\": \"Automated build from commit ${{ github.sha }}\", \"draft\": false, \"prerelease\": false}" \ -d "{\"tag_name\": \"$TAG\", \"name\": \"Latest Build\", \"body\": \"Automated build from commit ${{ github.sha }}\", \"draft\": false, \"prerelease\": false}" \
"$GITEA_API/repos/$REPO/releases") "$GITEA_API/repos/$REPO/releases")
echo "Create release response: $RELEASE_RESPONSE" 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" echo "Created release ID: $RELEASE_ID"
if [ -z "$RELEASE_ID" ]; then
echo "Failed to create release, aborting"
exit 1
fi
echo "Uploading APK..." echo "Uploading APK..."
curl -sS -w "\nHTTP_STATUS:%{http_code}" -X POST \ curl -sS -X POST \
-H "Authorization: token $GITEA_TOKEN" \ -H "Authorization: token $GITEA_TOKEN" \
-F "attachment=@bluesky-custom.apk" \ -F "attachment=@bluesky-custom.apk" \
"$GITEA_API/repos/$REPO/releases/$RELEASE_ID/assets?name=bluesky-custom.apk" "$GITEA_API/repos/$REPO/releases/$RELEASE_ID/assets?name=bluesky-custom.apk"