chore(release): enhance release workflow to safely handle APK naming with ref-based fallback

This commit is contained in:
2026-03-16 20:30:40 +01:00
parent 0059095e38
commit 74a801c6f2

View File

@@ -129,10 +129,17 @@ jobs:
- name: Copy new APK to repo - name: Copy new APK to repo
run: | run: |
# The app-release.apk name should ideally include the version number set -e
# so it doesn't overwrite older versions in the repo. mkdir -p fdroid/repo
VERSION_TAG=${GITHUB_REF#refs/tags/} # gets 'v1.0.0'
cp build/app/outputs/flutter-apk/app-release.apk fdroid/repo/my_flutter_app_${VERSION_TAG}.apk # Prefer tag name for release builds; fallback to ref name for manual runs.
REF_NAME="${GITHUB_REF_NAME:-${GITHUB_REF##*/}}"
SAFE_REF_NAME="$(echo "$REF_NAME" | tr '/ ' '__' | tr -cd '[:alnum:]_.-')"
if [ -z "$SAFE_REF_NAME" ]; then
SAFE_REF_NAME="${GITHUB_SHA:-manual}"
fi
cp build/app/outputs/flutter-apk/app-release.apk "fdroid/repo/my_flutter_app_${SAFE_REF_NAME}.apk"
- name: Generate F-Droid Index - name: Generate F-Droid Index
run: | run: |