From d74a6aeeb630c099a62d9399a2a86bd5bf9b265f Mon Sep 17 00:00:00 2001 From: jwinterm Date: Fri, 2 Oct 2026 13:42:11 -0400 Subject: [PATCH] ci(android): name the APK and AAB after the version they carry Flutter writes app-release.{apk,aab} for every build, so each release's artifact unzips to the same filename. A stale 1.0.3 app-release.aab in Downloads was uploaded to the 1.0.4 Play release and refused for reusing versionCode 13. Copy the outputs to hash-bags--build.* from pubspec_description.yaml and upload those, refusing if the version line does not parse. --- .github/workflows/build-android.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 97de57745..5bd8df3b6 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -306,17 +306,38 @@ jobs: echo "apksigner not on PATH; skipping sig print" fi + # Flutter names every build app-release.{apk,aab}, so two releases unzip + # to identical filenames and an old one in ~/Downloads looks exactly like + # the new one. That is how 1.0.3's AAB got dropped into the 1.0.4 Play + # release. Name the files after the version they carry. + - name: Name the outputs after their version + id: names + run: | + set -euo pipefail + FULL=$(awk '/^version:/ {print $2; exit}' pubspec_description.yaml) + VER="${FULL%%+*}"; BUILD="${FULL#*+}" + if [ -z "$VER" ] || [ "$BUILD" = "$FULL" ]; then + echo "pubspec_description.yaml version '$FULL' is not +; refusing to guess a name" >&2 + exit 1 + fi + BASE="hash-bags-${VER}-build${BUILD}" + mkdir -p dist + cp build/app/outputs/flutter-apk/app-release.apk "dist/${BASE}.apk" + cp build/app/outputs/bundle/release/app-release.aab "dist/${BASE}.aab" + echo "base=$BASE" >> "$GITHUB_OUTPUT" + ls -la dist + # actions/upload-artifact@v4 doesn't work on Gitea; pin to v3. - name: Upload APK artifact (sideload-able) uses: actions/upload-artifact@v3 with: - name: hash-wallet-android-apk-${{ github.sha }} - path: build/app/outputs/flutter-apk/app-release.apk + name: ${{ steps.names.outputs.base }}-apk-${{ github.sha }} + path: dist/${{ steps.names.outputs.base }}.apk retention-days: 14 - name: Upload AAB artifact (for Play Console) uses: actions/upload-artifact@v3 with: - name: hash-wallet-android-aab-${{ github.sha }} - path: build/app/outputs/bundle/release/app-release.aab + name: ${{ steps.names.outputs.base }}-aab-${{ github.sha }} + path: dist/${{ steps.names.outputs.base }}.aab retention-days: 30