selfprivacy.org.app/.drone.yml
2022-08-31 18:46:27 +03:00

76 lines
2 KiB
YAML

kind: pipeline
type: exec
name: Continuous Integration
steps:
- name: Build Debug Artifacts
commands:
- flutter build apk --debug --split-per-abi
- mv build/app/outputs/flutter-apk/*-debug.apk `pwd`
- rename app pro.kherel.selfprivacy *.apk && rename debug "$DRONE_COMMIT" *.apk
- ls *.apk
trigger:
event:
- push
- pull_request
node:
server: builder
---
kind: pipeline
type: exec
name: Release
steps:
- 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 -
# 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"
# 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
- name: Deploy on F-Droid Repository
commands:
# Prepare SSH keys
- eval `ssh-agent -s`
- echo "$SSH_PRIVATE_KEY" | ssh-add -
# Copy the artifacts to the F-Droid repository
- ls repo/
environment:
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
trigger:
event:
- tag
node:
server: builder