From 331ec5ffc5161bb950d4f785804421d43d202cec Mon Sep 17 00:00:00 2001 From: Alya Sirko Date: Wed, 31 Aug 2022 18:46:27 +0300 Subject: [PATCH] deploy on fdroid --- .drone.yml | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.drone.yml b/.drone.yml index ece87434..f38c33fc 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,24 +25,33 @@ type: exec name: Release steps: - - name: Build Release Artifacts + - name: Prepare for Build + commands: + # Reset building environment + - nixos-container stop isolated + - nixos-container start isolated + # Prepare SSH keys + - eval `ssh-agent -s` + - echo "$SSH_PRIVATE_KEY" | ssh-add - + # Copy sources to the building environment + - scp -r `pwd` builder@isolated:/var/lib/builder + + - name: Build and Sign Release Artifact for F-Droid Repository commands: # Prepare SSH keys - eval `ssh-agent -s` - echo "$SSH_PRIVATE_KEY" | ssh-add - - # Reset building environment - - nixos-container stop isolated - - nixos-container start isolated - # Copy sources to the building environment - - scp -r `pwd` isolated:/var/lib/builder - # Build release artifacts - - ssh isolated "cd src && flutter build apk --release" - # Fetch the release artifacts - - scp isolated:/var/lib/builder/src/build/app/outputs/flutter-apk/app-release.apk `pwd` - # Rename the artifacts in a more informative way + # Build release artifact + - ssh builder@isolated "cd src && flutter build apk --release" + # Fetch the release artifact + - scp builder@isolated:/var/lib/builder/src/build/app/outputs/flutter-apk/app-release.apk `pwd` + # Rename the artifact in a more informative way - export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2` - mv app-release.apk "pro.kherel.selfprivacy_$APP_BUILD_ID.apk" - - ls *.apk + # Upload and sign the artifact + - scp "pro.kherel.selfprivacy_$APP_BUILD_ID.apk" fdroid@isolated:/var/lib/fdroid/unsigned + - ssh fdroid@isolated "fdroid publish && fdroid update" + - scp -r fdroid@isolated:/var/lib/fdroid/repo `pwd` environment: SSH_PRIVATE_KEY: from_secret: SSH_PRIVATE_KEY @@ -53,7 +62,7 @@ steps: - eval `ssh-agent -s` - echo "$SSH_PRIVATE_KEY" | ssh-add - # Copy the artifacts to the F-Droid repository - - scp *.apk ci:/var/lib/fdroid/unsigned + - ls repo/ environment: SSH_PRIVATE_KEY: from_secret: SSH_PRIVATE_KEY