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-<version>-build<N>.* from
pubspec_description.yaml and upload those, refusing if the version line
does not parse.
This commit is contained in:
jwinterm
2026-10-02 13:42:11 -04:00
parent b07adfff5b
commit d74a6aeeb6
+25 -4
View File
@@ -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 <name>+<build>; 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