From cfac7428567c590bbef1947202f3dc224096a6d5 Mon Sep 17 00:00:00 2001 From: Amir Date: Sun, 24 May 2026 18:51:37 +0000 Subject: [PATCH] ci: add Gitea Actions workflow to build and attach APK on tag push MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Triggers on v* tags — sets up Java 17 + Android SDK, builds a debug APK (installable without a keystore), renames it SyncFlow-v.apk, and uploads it to the matching Gitea release via the API using the built-in token. Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/release.yml | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..86ef475 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,52 @@ +name: Build & Release APK + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - uses: android-actions/setup-android@v3 + + - name: Build debug APK + run: | + chmod +x gradlew + ./gradlew assembleDebug --no-daemon + + - name: Get version name + id: ver + run: echo "name=$(grep VERSION_NAME version.properties | cut -d= -f2)" >> $GITHUB_OUTPUT + + - name: Rename APK + run: | + mkdir dist + cp app/build/outputs/apk/debug/app-debug.apk \ + dist/SyncFlow-v${{ steps.ver.outputs.name }}.apk + + - name: Attach APK to release + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + VERSION: ${{ steps.ver.outputs.name }} + run: | + RELEASE_ID=$(curl -sf \ + "https://gitea.khodak.me/api/v1/repos/amir/SyncFlow/releases/tags/$TAG" \ + -H "Authorization: token $TOKEN" \ + | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") + curl -sf -X POST \ + "https://gitea.khodak.me/api/v1/repos/amir/SyncFlow/releases/$RELEASE_ID/assets" \ + -H "Authorization: token $TOKEN" \ + -F "attachment=@dist/SyncFlow-v${VERSION}.apk" + echo "APK uploaded to release $TAG"