From 1e3636456b0fe7d81e480d0fe7e6cfca3b63bb46 Mon Sep 17 00:00:00 2001 From: Toaster Date: Tue, 8 Sep 2026 14:21:12 +0000 Subject: [PATCH] Update .gitea/workflows/build-android.yaml --- .gitea/workflows/build-android.yaml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/build-android.yaml b/.gitea/workflows/build-android.yaml index eef0530213..8116b359c8 100644 --- a/.gitea/workflows/build-android.yaml +++ b/.gitea/workflows/build-android.yaml @@ -113,19 +113,39 @@ jobs: name: Bluesky-Custom-Release path: bluesky-custom.apk - - name: Create Gitea Release with APK + - name: Create Rolling Latest Release with APK env: GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITEA_API: ${{ github.server_url }}/api/v1 REPO: ${{ github.repository }} run: | - TAG="build-${{ github.run_number }}" + TAG="latest" - # Create the release + # Look up any existing "latest" release + EXISTING_RELEASE=$(curl -s \ + -H "Authorization: token $GITEA_TOKEN" \ + "$GITEA_API/repos/$REPO/releases/tags/$TAG") + + EXISTING_ID=$(echo "$EXISTING_RELEASE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') + + # If it exists, delete the release itself + if [ -n "$EXISTING_ID" ]; then + echo "Deleting existing release ID: $EXISTING_ID" + curl -s -X DELETE \ + -H "Authorization: token $GITEA_TOKEN" \ + "$GITEA_API/repos/$REPO/releases/$EXISTING_ID" + fi + + # Delete the old tag too, so a fresh one can be created cleanly + curl -s -X DELETE \ + -H "Authorization: token $GITEA_TOKEN" \ + "$GITEA_API/repos/$REPO/tags/$TAG" + + # Create the new rolling release RELEASE_RESPONSE=$(curl -s -X POST \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ - -d "{\"tag_name\": \"$TAG\", \"name\": \"Build $TAG\", \"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") RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')