selfprivacy.org.app/.drone.yml

117 lines
3.9 KiB
YAML
Raw Normal View History

kind: pipeline
type: exec
2022-08-31 12:43:07 +00:00
name: Continuous Integration
2022-08-31 10:17:35 +00:00
steps:
2022-08-31 12:43:07 +00:00
- name: Build Debug Artifacts
2022-08-31 10:17:35 +00:00
commands:
2022-08-31 11:35:44 +00:00
- 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
2022-08-31 10:17:35 +00:00
2022-08-31 11:55:54 +00:00
trigger:
event:
- push
- pull_request
2022-08-31 10:17:35 +00:00
node:
server: builder
---
2022-08-31 12:43:07 +00:00
2022-08-31 10:17:35 +00:00
kind: pipeline
type: exec
2022-08-31 12:43:07 +00:00
name: Release
steps:
2022-08-31 15:46:27 +00:00
- name: Prepare for Build
commands:
2022-08-31 12:53:02 +00:00
# Reset building environment
- nixos-container stop isolated
- nixos-container start isolated
2022-08-31 15:46:27 +00:00
# Prepare SSH keys
- eval `ssh-agent -s`
- echo "$SSH_PRIVATE_KEY" | ssh-add -
2022-08-31 12:53:02 +00:00
# Copy sources to the building environment
2022-08-31 15:46:27 +00:00
- scp -r `pwd` builder@isolated:/var/lib/builder
2022-08-31 15:49:15 +00:00
environment:
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
2022-08-31 15:46:27 +00:00
2022-09-02 00:24:14 +00:00
- name: Build Intermediate Release Artifact
2022-08-31 15:46:27 +00:00
commands:
# Prepare SSH keys
- eval `ssh-agent -s`
- echo "$SSH_PRIVATE_KEY" | ssh-add -
2022-09-02 00:24:14 +00:00
# Build intermediate release artifact
2022-08-31 15:46:27 +00:00
- 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`
2022-09-02 00:24:14 +00:00
environment:
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
- name: Sign Release Artifact for Standalone Use
commands:
# Get app build ID
2022-08-31 14:13:59 +00:00
- export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2`
2022-09-02 00:24:14 +00:00
# Prepare SSH keys
- eval `ssh-agent -s`
- echo "$SSH_PRIVATE_KEY" | ssh-add -
# Upload and sign the artifact
- scp app-release.apk builder@isolated:/var/lib/builder
- ssh builder@isolated "zipalign -f -v 4 app-release.apk standalone_app-release.apk && apksigner sign --ks /run/secrets/standalone-keystore --ks-key-alias standalone --ks-pass file:/run/secrets/standalone-keystore-pass standalone_app-release.apk"
# Fetch the signed artifact
2022-09-02 13:01:37 +00:00
- scp builder@isolated:/var/lib/builder/standalone_app-release.apk `pwd`/standalone_pro.kherel.selfprivacy_"$APP_BUILD_ID".apk"
- scp builder@isolated:/var/lib/builder/standalone_app-release.apk.idsig `pwd`/standalone_pro.kherel.selfprivacy_"$APP_BUILD_ID".apk.idsig"
2022-09-02 00:24:14 +00:00
environment:
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
- name: Sign Release Artifact for F-Droid Repository
2022-09-02 00:28:03 +00:00
commands:
2022-09-02 00:24:14 +00:00
# Get app build ID
- export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2`
# Prepare SSH keys
- eval `ssh-agent -s`
- echo "$SSH_PRIVATE_KEY" | ssh-add -
2022-08-31 15:46:27 +00:00
# Upload and sign the artifact
2022-09-02 13:01:37 +00:00
- scp app-release.apk fdroid@isolated:/var/lib/fdroid/unsigned/pro.kherel.selfprivacy_"$APP_BUILD_ID".apk
2022-09-02 09:02:23 +00:00
- ssh fdroid@isolated 'export FDROID_KEY_STORE_PASS=`cat /run/secrets/fdroid-keystore-pass` && fdroid publish && fdroid update'
2022-08-31 15:46:27 +00:00
- scp -r fdroid@isolated:/var/lib/fdroid/repo `pwd`
2022-08-31 12:55:04 +00:00
environment:
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
2022-08-27 21:05:13 +00:00
2022-09-02 12:02:47 +00:00
- name: Create Release on Gitea Repository
2022-09-02 11:59:04 +00:00
commands:
2022-09-02 13:01:37 +00:00
# Get app build ID
- export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2`
2022-09-02 11:59:04 +00:00
# Prepare tea CLI
- tea login add --token "$GITEA_RELEASE_TOKEN" --url https://git.selfprivacy.org
# Create release and push artifacts
2022-09-02 13:01:37 +00:00
- tea releases create --repo "$DRONE_REPO" --tag "$DRONE_SEMVER" --title "$DRONE_SEMVER" --asset standalone_pro.kherel.selfprivacy_"$APP_BUILD_ID".apk --asset standalone_pro.kherel.selfprivacy_"$APP_BUILD_ID".apk.idsig
2022-09-02 11:59:04 +00:00
environment:
GITEA_RELEASE_TOKEN:
from_secret: GITEA_RELEASE_TOKEN
2022-08-31 12:43:07 +00:00
- name: Deploy on F-Droid Repository
commands:
2022-08-31 12:53:02 +00:00
# Prepare SSH keys
- eval `ssh-agent -s`
- echo "$SSH_PRIVATE_KEY" | ssh-add -
2022-08-31 13:32:08 +00:00
# Copy the artifacts to the F-Droid repository
2022-09-02 00:24:14 +00:00
- ls
2022-08-31 15:46:27 +00:00
- ls repo/
2022-08-31 12:55:04 +00:00
environment:
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
2022-08-31 12:43:07 +00:00
2022-08-31 10:17:35 +00:00
trigger:
2022-08-31 11:35:44 +00:00
event:
- tag
2022-08-31 10:17:35 +00:00
2022-08-27 18:05:12 +00:00
node:
2022-08-27 20:59:33 +00:00
server: builder