Add automatic builds for lower android versions

This commit is contained in:
Pieter Vander Vennet 2025-07-21 21:15:53 +02:00
parent 17f87a9611
commit 4bb7346a3b
3 changed files with 30 additions and 8 deletions

View file

@ -46,15 +46,15 @@ jobs:
./gradlew assembleRelease
rm -rf app/build/outputs/apk/release/baselineProfiles
rm -rf app/build/outputs/apk/release/output-metadata.json
- name: Upload APK to hetzner
shell: bash
run: |
TAG=$( echo ${{ env.GITHUB_REF_NAME }} )
scp app/build/outputs/apk/release/app-release.apk hetzner:~/public/apk/mapcomplete-$TAG.apk
if [[ ! $tag =~ -sfw$ ]]; then
ssh hetzner 'rm -f public/apk/mapcomplete-latest.apk && cp "public/apk/$(ls -v public/apk/ | tail -n 1)" public/apk/mapcomplete-latest.apk'
fi
# Build versions vor legacy
./scripts/compile_version.shs $TAG 9-PIE 28
./scripts/compile_version.sh $TAG 10-QUINCE-TART 29
./scripts/compile_version.sh $TAG 11-RED-VELVET-CAKE 30
./scripts/compile_version.sh $TAG 12-SNOW-CONE 31
./scripts/compile_version.sh $TAG 13-TIRAMISU 32
- name: Upload APK to forgejo releases (MapComplete)
uses: https://source.mapcomplete.org/actions/forgejo-release@v2.6.0

View file

@ -5,7 +5,7 @@ android {
compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "org.mapcomplete"
minSdk 30
minSdk 33
targetSdkVersion targetSdkVersion
versionCode 9
versionName "debug"
@ -75,3 +75,9 @@ try {
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}

16
scripts/compile_version.sh Executable file
View file

@ -0,0 +1,16 @@
#! /bin/bash
# Edit the 'build.gradle' file to a certain target sdk
TAG="$1"
LABEL="$2"
VERSION="$3"
echo "Setting $VERSION"
# sed -i "s/compileSdkVersion *[0-9]\+/compileSdkVersion $VERSION/" app/build.gradle
sed -i "s/minSdk *[0-9]\+/minSdk $VERSION/" app/build.gradle
sed -i "s/targetSdkVersion *[0-9]\+/targetSdkVersion $VERSION/" app/build.gradle
./gradlew build
scp app/build/outputs/apk/release/app-release.apk hetzner:~/public/apk/mapcomplete-$TAG-$LABEL.apk
ssh hetzner "cp ~/public/apk/mapcomplete-$TAG-$LABEL.apk ~/public/apk/mapcomplete-latest-$LABEL.apk"