From b5a3a3b427df41b8fbb7200b25ed3a28986c1ca1 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Thu, 3 Sep 2026 20:19:59 +0200 Subject: [PATCH] fix(ci): make the test-APK dispatch inputs work and stop it always publishing Two defects in a workflow that had never actually run. The publish guard was `if: ${{ inputs.publish }}`. A dispatch input arrives as a *string*, and every non-empty string is truthy in the expression language, so "false" is truthy too -- the workflow would have published a public pre-release on every run, including the ones where the box was deliberately left unticked. Now compared against 'true' explicitly. The bare `inputs.*` context is also newer than `github.event.inputs.*` and no other workflow here uses either, so nothing proved the short form works on this Gitea. Switched to the form both Gitea and GitHub have supported throughout; an unresolved context would have silently expanded to an empty string, sending every build down the `debug` branch and then failing to find a `*-debug.apk`. --- .gitea/workflows/build-test-apk.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/build-test-apk.yml b/.gitea/workflows/build-test-apk.yml index 944ac182..dbe1fe70 100644 --- a/.gitea/workflows/build-test-apk.yml +++ b/.gitea/workflows/build-test-apk.yml @@ -63,7 +63,7 @@ env: jobs: build: - name: Build test APK (${{ inputs.variant }}, ${{ inputs.abi }}) + name: Build test APK (${{ github.event.inputs.variant }}, ${{ github.event.inputs.abi }}) runs-on: linux/amd64 container: image: gitea.tourolle.paris/dtourolle/jellytau-builder:2026.08.1 @@ -129,30 +129,30 @@ jobs: # APK actually carries, which has silently regressed before. - name: Build APK run: | - if [ "${{ inputs.variant }}" = "side-by-side-release" ]; then - ./scripts/build-android.sh release --debug --abi "${{ inputs.abi }}" + if [ "${{ github.event.inputs.variant }}" = "side-by-side-release" ]; then + ./scripts/build-android.sh release --debug --abi "${{ github.event.inputs.abi }}" else - ./scripts/build-android.sh debug --abi "${{ inputs.abi }}" + ./scripts/build-android.sh debug --abi "${{ github.event.inputs.abi }}" fi - name: Collect APK id: collect run: | mkdir -p dist/test-apk - if [ "${{ inputs.variant }}" = "side-by-side-release" ]; then + if [ "${{ github.event.inputs.variant }}" = "side-by-side-release" ]; then PATTERN='*-release.apk' else PATTERN='*-debug.apk' fi APK=$(find src-tauri/gen/android/app/build/outputs/apk -name "$PATTERN" | head -1) if [ -z "$APK" ]; then - echo "❌ No APK produced for variant ${{ inputs.variant }}" + echo "❌ No APK produced for variant ${{ github.event.inputs.variant }}" find src-tauri/gen/android/app/build/outputs/apk -name '*.apk' || true exit 1 fi REF_NAME=$(echo "${GITHUB_REF#refs/heads/}" | tr '/' '-') - OUT="dist/test-apk/jellytau-${REF_NAME}-${GITHUB_SHA::8}-${{ inputs.variant }}.apk" + OUT="dist/test-apk/jellytau-${REF_NAME}-${GITHUB_SHA::8}-${{ github.event.inputs.variant }}.apk" cp "$APK" "$OUT" # Report what the thing actually is, not what it was meant to be. @@ -166,8 +166,8 @@ jobs: echo "|---|---|" echo "| Branch | \`${GITHUB_REF#refs/heads/}\` |" echo "| Commit | \`${GITHUB_SHA::8}\` |" - echo "| Variant | \`${{ inputs.variant }}\` |" - echo "| ABI | \`${{ inputs.abi }}\` |" + echo "| Variant | \`${{ github.event.inputs.variant }}\` |" + echo "| ABI | \`${{ github.event.inputs.abi }}\` |" echo "| Size | $(du -h "$OUT" | cut -f1) |" echo "| SHA256 | \`$(sha256sum "$OUT" | cut -d' ' -f1)\` |" echo "" @@ -190,7 +190,12 @@ jobs: # static latest.json from the `updater` branch, not the release list, so a # pre-release published here is invisible to anyone without the link. - name: Publish as a pre-release - if: ${{ inputs.publish }} + # Compared against the string 'true', not used as a bare truthiness + # test. A dispatch input arrives as a *string*, and every non-empty + # string is truthy in the expression language — so `if: inputs.publish` + # would publish a pre-release on every run, including the ones where the + # box was deliberately left unticked. + if: ${{ github.event.inputs.publish == 'true' }} env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} AUTO_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -212,7 +217,7 @@ jobs: "normal install and with its own separate data. Uninstalling it does not touch" \ "the real app." \ "" \ - "Variant: \`${{ inputs.variant }}\` · ABI: \`${{ inputs.abi }}\`" \ + "Variant: \`${{ github.event.inputs.variant }}\` · ABI: \`${{ github.event.inputs.abi }}\`" \ "" \ "Android will warn about installing from an unknown source; that is expected" \ "for a build signed with a debug key rather than the store key.")