From a026f0b349e1cdd5616671a34a29d3cddea566fe Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Fri, 1 May 2026 19:18:46 +0300 Subject: [PATCH] ci(android): fail-fast on missing release keystore before SDK setup Move the keystore guard from after the Decode step (step 9) to right after Resolve build label (step 3). A release tag pushed without ANDROID_KEYSTORE_BASE64 configured now fails in seconds instead of after JDK + Python + Android SDK + NDK install (~3-5 min of wasted runner time). Switched the condition from steps.keystore.outputs.present to env.ANDROID_KEYSTORE_BASE64 since the env var is set at job level and the keystore decode step has not yet run at the new position. --- .gitea/workflows/build-android.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/build-android.yml b/.gitea/workflows/build-android.yml index f27cf42..41163b4 100644 --- a/.gitea/workflows/build-android.yml +++ b/.gitea/workflows/build-android.yml @@ -54,6 +54,17 @@ jobs: echo "is_release=$IS_RELEASE" >> "$GITHUB_OUTPUT" echo "Build label: $LABEL (release=$IS_RELEASE)" + - name: Guard release tag against missing keystore + # Release tags MUST produce a release-signed APK, otherwise existing + # installs can't upgrade (signature mismatch). Fail loudly instead + # of silently falling back to the debug signing config. + # Runs before JDK/Python/SDK/NDK setup so a misconfigured release + # tag fails in seconds instead of after several minutes of setup. + if: ${{ steps.label.outputs.is_release == 'true' && env.ANDROID_KEYSTORE_BASE64 == '' }} + run: | + echo "::error::Release tag ${{ gitea.ref_name }} requires ANDROID_KEYSTORE_BASE64 (plus KEYSTORE_PASSWORD, KEY_ALIAS, KEY_PASSWORD) to be configured in Gitea → Settings → Secrets." + exit 1 + - name: Setup JDK ${{ env.JAVA_VERSION }} uses: actions/setup-java@v4 with: @@ -122,15 +133,6 @@ jobs: echo "path=$(pwd)/android/keystore/release.jks" >> "$GITHUB_OUTPUT" echo "present=true" >> "$GITHUB_OUTPUT" - - name: Guard release tag against missing keystore - # Release tags MUST produce a release-signed APK, otherwise existing - # installs can't upgrade (signature mismatch). Fail loudly instead - # of silently falling back to the debug signing config. - if: ${{ steps.label.outputs.is_release == 'true' && steps.keystore.outputs.present != 'true' }} - run: | - echo "::error::Release tag ${{ gitea.ref_name }} requires ANDROID_KEYSTORE_BASE64 (plus KEYSTORE_PASSWORD, KEY_ALIAS, KEY_PASSWORD) to be configured in Gitea → Settings → Secrets." - exit 1 - - name: Build APK working-directory: android env: