new podman-based pipeline

This commit is contained in:
Alya Sirko 2022-09-09 20:40:05 +03:00
parent 13ad5a9980
commit 1b1bf6b261
2 changed files with 16 additions and 9 deletions

View file

@ -22,6 +22,7 @@ steps:
- name: Prepare - name: Prepare
commands: commands:
- ln -s /var/lib/drone-runner-exec/.local $HOME/.local - ln -s /var/lib/drone-runner-exec/.local $HOME/.local
- podman volume exists src || podman volume rm -f src
- podman volume exists src || podman volume create src - podman volume exists src || podman volume create src
- git archive --format=tar HEAD | podman volume import src - - git archive --format=tar HEAD | podman volume import src -

24
ci.sh
View file

@ -2,6 +2,11 @@
set -o errexit -o pipefail -o noclobber -o nounset -x set -o errexit -o pipefail -o noclobber -o nounset -x
CONTAINER_IMAGE="localhost/flutter-build-env" CONTAINER_IMAGE="localhost/flutter-build-env"
APP_NAME="pro.kherel.selfprivacy"
APP_VERSION_FULL="$(yq '.version' pubspec.yaml)"
APP_SEMVER="$(printf $APP_VERSION_FULL | cut -d '+' -f1)"
APP_BUILD_ID="$(printf $APP_VERSION_FULL | cut -d '+' -f2)"
OPTS=$(getopt -o "" --long "build-linux,build-apk,sign-apk-standalone,sign-apk-fdroid,package-linux-appimage,package-linux-flatpak,package-linux-archive" -- "$@") OPTS=$(getopt -o "" --long "build-linux,build-apk,sign-apk-standalone,sign-apk-fdroid,package-linux-appimage,package-linux-flatpak,package-linux-archive" -- "$@")
eval set -- "$OPTS" eval set -- "$OPTS"
@ -10,7 +15,7 @@ usage () {
} }
podman_offline () { podman_offline () {
podman run --rm -v "src:/var/lib/builder/src:U" -v "/var/lib/drone-runner-exec/fdroid:/var/lib/builder/repo:U" -v "/var/lib/drone-runner-exec/fdroid-keystore:/var/lib/builder/repo/fdroid-keystore:U" -v "/var/lib/drone-runner-exec/standalone-keystore:/var/lib/builder/repo/standalone-keystore:U" --env FDROID_KEYSTORE_PASS="$FDROID_KEYSTORE_PASS" --env STANDALONE_KEYSTORE_PASS="$STANDALONE_KEYSTORE_PASS" --network=none --workdir $1 "$CONTAINER_IMAGE" $2 podman run --rm -v "src:/var/lib/builder/src:U" -v "/var/lib/drone-runner-exec/fdroid:/var/lib/builder/fdroid:U" -v "/var/lib/drone-runner-exec/fdroid-keystore:/var/lib/builder/fdroid/fdroid-keystore:U" -v "/var/lib/drone-runner-exec/standalone-keystore:/var/lib/builder/fdroid/standalone-keystore:U" --env FDROID_KEYSTORE_PASS="$FDROID_KEYSTORE_PASS" --env STANDALONE_KEYSTORE_PASS="$STANDALONE_KEYSTORE_PASS" --network=none --workdir $1 "$CONTAINER_IMAGE" $2
} }
podman_online () { podman_online () {
@ -19,22 +24,23 @@ podman_online () {
build_linux () { build_linux () {
podman_offline "/var/lib/builder/src" "flutter pub get --offline" podman_offline "/var/lib/builder/src" "flutter pub get --offline"
podman_offline "/var/lib/builder/src" "flutter build linux -v" podman_offline "/var/lib/builder/src" "flutter build linux"
} }
build_apk () { build_apk () {
podman_offline "/var/lib/builder/src" "flutter pub get --offline" podman_offline "/var/lib/builder/src" "flutter pub get --offline"
podman_offline "/var/lib/builder/src" "flutter build apk -v" podman_offline "/var/lib/builder/src" "flutter build apk"
} }
sign_apk_standalone () { sign_apk_standalone () {
podman_offline "/var/lib/builder/repo" "cp /var/lib/builder/src/build/app/outputs/flutter-apk/app-release.apk ." podman_offline "/var/lib/builder/fdroid" "zipalign -f -v 4 ../src/build/app/outputs/flutter-apk/app-release.apk standalone_$APP_NAME-$APP_SEMVER.apk"
podman_offline "/var/lib/builder/repo" "zipalign -f -v 4 app-release.apk standalone_app-release.apk" podman_offline "/var/lib/builder/fdroid" "apksigner sign --ks standalone-keystore --ks-key-alias standalone --ks-pass env:STANDALONE_KEYSTORE_PASS standalone_$APP_NAME-$APP_SEMVER.apk"
podman_offline "/var/lib/builder/repo" "apksigner sign --ks /var/lib/builder/repo/standalone-keystore --ks-key-alias standalone --ks-pass env:STANDALONE_KEYSTORE_PASS standalone_app-release.apk"
} }
sign_apk_fdroid () { sign_apk_fdroid () {
podman_offline "/var/lib/builder/repo" "cp /var/lib/builder/src/build/app/outputs/flutter-apk/app-release.apk unsigned/" podman_offline "/var/lib/builder/fdroid" "if [[ ! -f repo/$APP_NAME_$APP_BUILD_ID.apk ]]; then cp ../src/build/app/outputs/flutter-apk/app-release.apk unsigned; fi"
podman_offline "/var/lib/builder/fdroid" "fdroid publish"
podman_offline "/var/lib/builder/fdroid" "fdroid update"
} }
package_linux_appimage () { package_linux_appimage () {
@ -43,11 +49,11 @@ package_linux_appimage () {
package_linux_flatpak () { package_linux_flatpak () {
podman_online "/var/lib/builder/src" "flatpak-builder --disable-rofiles-fuse --force-clean --repo=flatpak-repo flatpak-build flatpak.yml" podman_online "/var/lib/builder/src" "flatpak-builder --disable-rofiles-fuse --force-clean --repo=flatpak-repo flatpak-build flatpak.yml"
podman_online "/var/lib/builder/src" "flatpak build-bundle flatpak-repo selfprivacy.flatpak pro.kherel.selfprivacy" podman_online "/var/lib/builder/src" "flatpak build-bundle flatpak-repo $APP_NAME-$APP_SEMVER.flatpak pro.kherel.selfprivacy"
} }
package_linux_archive () { package_linux_archive () {
podman_online "/var/lib/builder/src" "tar -C build/linux/x64/release/bundle -vacf selfprivacy.tar.zstd ." podman_online "/var/lib/builder/src" "tar -C build/linux/x64/release/bundle -vacf $APP_NAME-$APP_SEMVER.tar.zstd ."
} }
while true; do while true; do