artifacts: - goguma/build/app/outputs/flutter-apk/app-release.apk environment: BUILD_SUBMITTER: yojo GIT_REF: refs/heads/master image: archlinux packages: - android-sdk - android-sdk-build-tools - android-sdk-cmdline-tools-latest - android-sdk-platform-tools - jdk17-openjdk - unzip secrets: - fa5c1c68-d266-4770-bfc3-a4068b1676a0 - 6d21b97d-cd64-4490-b325-acf8b05a542f - 431b0b53-2af2-441b-b879-86c5913bab4d - 4e454305-057f-44c3-9a4e-eeb74d54545b - a76ea4e0-b264-4b32-b701-7cadf78b3230 sources: - https://codeberg.org/emersion/goguma.git#c96e7e7e95b7966081694c451cfde753b5416bbf tasks: - flutter: | git clone --depth=1 --branch=stable https://github.com/flutter/flutter.git export PATH="$PATH:$PWD/flutter/bin" echo "PATH=$PATH" >>~/.buildenv flutter precache --android # need write permission or else licenses are never accepted sudo chown -R $USER /opt/android-sdk yes | flutter doctor --android-licenses >/dev/null flutter doctor -v # the gradle daemon sometimes crashes mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >>~/.gradle/gradle.properties - configure: | cd goguma [ -e ~/keystore.properties ] && ln -s ~/keystore.properties android/keystore.properties [ -e ~/keystore.jks ] && ln -s ~/keystore.jks android/keystore.jks flutter pub get if [ -e ~/google-services.json ]; then dart run tool/gen_main.dart --firebase ~/google-services.json lib/main_generated.dart fi - analyze: | cd goguma flutter analyze --no-fatal-infos - build: | cd goguma tag="$(git describe --abbrev=0)" hash="$(git rev-parse --short=12 HEAD)" build_name="${tag#v}-dev+$hash" build_number="$(git rev-list --first-parent --count origin/master)" target=lib/main.dart if [ -e ~/google-services.json ]; then build_name="$build_name.firebase" target=lib/main_generated.dart fi sentry_dsn="" [ -e ~/sentry-dsn.txt ] && sentry_dsn="$(cat ~/sentry-dsn.txt)" flutter build apk \ --build-name="$build_name" \ --build-number="$build_number" \ --target="$target" \ --dart-define=SENTRY_DSN="$sentry_dsn" \ --dart-define=SENTRY_ENVIRONMENT="nightly" \ --dart-define=SENTRY_RELEASE="$build_name" - deploy: | cd goguma [ -e ~/.ssh/id_rsa ] || complete-build [ "$(git rev-parse origin/master)" = "$(git rev-parse HEAD)" ] || complete-build build_number="$(git rev-list --first-parent --count origin/master)" ssh_opts="-o StrictHostKeyChecking=no" ssh_host="deploy-goguma@sheeta.emersion.fr" scp $ssh_opts build/app/outputs/flutter-apk/app-release.apk "$ssh_host":fdroid-nightly/repo/goguma-"$build_number".apk ssh $ssh_opts "$ssh_host" "cd fdroid-nightly && (ls -t repo/*.apk | tail -n +5 | xargs -r rm --) && fdroid update"