From 12d2d09510f6c7f740600e13e258e49639f3e3cb Mon Sep 17 00:00:00 2001 From: dusy4 <56517228+dusy4@users.noreply.github.com> Date: Fri, 8 May 2026 22:20:24 +0200 Subject: [PATCH 1/2] ci(android): fix workflow YAML syntax and harden conditions --- .github/workflows/android-release.yml | 82 +++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/android-release.yml diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml new file mode 100644 index 0000000..5a6248c --- /dev/null +++ b/.github/workflows/android-release.yml @@ -0,0 +1,82 @@ +name: "Android APK CI and Release" + +on: + push: + branches: [main] + tags: ['v*'] + pull_request: + branches: [main] + workflow_dispatch: + inputs: + release_tag: + description: "Optional tag to publish (example: v1.0.0). Leave empty for build-only run." + required: false + type: string + +permissions: + contents: write + +jobs: + build_apk: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build release APK + working-directory: android + run: ./gradlew --no-daemon assembleRelease + + - name: Upload APK artifact + uses: actions/upload-artifact@v4 + with: + name: app-release-apk + path: android/app/build/outputs/apk/release/app-release.apk + + publish_release: + needs: build_apk + runs-on: ubuntu-latest + if: ${{ startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag != '') }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Resolve release tag + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "RELEASE_TAG=${{ github.event.inputs.release_tag }}" >> "$GITHUB_ENV" + else + echo "RELEASE_TAG=${GITHUB_REF_NAME}" >> "$GITHUB_ENV" + fi + + - name: Ensure tag exists for manual run + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git tag "$RELEASE_TAG" "${{ github.sha }}" || true + git push origin "$RELEASE_TAG" + + - name: Download APK artifact + uses: actions/download-artifact@v4 + with: + name: app-release-apk + path: dist + + - name: Attach APK to GitHub release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.RELEASE_TAG }} + generate_release_notes: true + files: dist/app-release.apk From 871d26d0c34998337036809cbaa1b4f73afed9b7 Mon Sep 17 00:00:00 2001 From: dusy4 <56517228+dusy4@users.noreply.github.com> Date: Fri, 8 May 2026 22:26:04 +0200 Subject: [PATCH 2/2] ci(android): quote on key to avoid yaml parser issue --- .github/workflows/android-release.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 5a6248c..76c7a2f 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -1,17 +1,19 @@ -name: "Android APK CI and Release" +name: Android Release APK -on: +'on': push: - branches: [main] - tags: ['v*'] + branches: + - main + tags: + - 'v*' pull_request: - branches: [main] + branches: + - main workflow_dispatch: inputs: release_tag: - description: "Optional tag to publish (example: v1.0.0). Leave empty for build-only run." + description: Optional tag to publish (example v1.0.0). Leave empty for build only. required: false - type: string permissions: contents: write @@ -45,7 +47,7 @@ jobs: publish_release: needs: build_apk runs-on: ubuntu-latest - if: ${{ startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag != '') }} + if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag != '') steps: - name: Checkout uses: actions/checkout@v4 @@ -61,7 +63,7 @@ jobs: fi - name: Ensure tag exists for manual run - if: ${{ github.event_name == 'workflow_dispatch' }} + if: github.event_name == 'workflow_dispatch' run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com"