test pipeline

This commit is contained in:
Alya Sirko 2022-09-09 14:25:08 +03:00
parent 13c60141e5
commit e2ea1c7eb9

View file

@ -2,13 +2,13 @@ kind: pipeline
type: exec type: exec
name: Continuous Integration name: Continuous Integration
environment:
test: echo hi
steps: steps:
- name: Build Debug Artifacts - name: Test
commands: commands:
- flutter build apk --debug --split-per-abi - "$test"
- mv build/app/outputs/flutter-apk/*-debug.apk .
- rename app pro.kherel.selfprivacy *.apk && rename debug "$DRONE_COMMIT" *.apk
- ls *.apk
trigger: trigger:
event: event:
@ -18,98 +18,81 @@ trigger:
node: node:
server: builder server: builder
--- #---
kind: pipeline #kind: pipeline
type: exec #type: exec
name: Release #name: Release
#
steps: #steps:
- name: Prepare for Build # - name: Build Intermediate Release Artifact
commands: # commands:
# Reset building environment # # Prepare SSH keys
- nixos-container stop isolated # - eval `ssh-agent -s`
- nixos-container start isolated # - echo "$SSH_PRIVATE_KEY" | ssh-add -
# Prepare SSH keys # # Build intermediate release artifact
- eval `ssh-agent -s` # - ssh builder@isolated "cd src && flutter build apk --release"
- echo "$SSH_PRIVATE_KEY" | ssh-add - # # Fetch the release artifact
# Copy sources to the building environment # - scp builder@isolated:src/build/app/outputs/flutter-apk/app-release.apk .
- scp -r `pwd` builder@isolated:~ #
environment: # - name: Sign Release Artifact for Standalone Use
SSH_PRIVATE_KEY: # commands:
from_secret: SSH_PRIVATE_KEY # # Get app build ID
# - export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2`
- name: Build Intermediate Release Artifact # # Prepare SSH keys
commands: # - eval `ssh-agent -s`
# Prepare SSH keys # - echo "$SSH_PRIVATE_KEY" | ssh-add -
- eval `ssh-agent -s` # # Upload and sign the artifact
- echo "$SSH_PRIVATE_KEY" | ssh-add - # - scp app-release.apk builder@isolated:~
# Build intermediate release artifact # - 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"
- ssh builder@isolated "cd src && flutter build apk --release" # # Fetch the signed artifact
# Fetch the release artifact # - scp builder@isolated:standalone_app-release.apk standalone_pro.kherel.selfprivacy_"$APP_BUILD_ID".apk
- scp builder@isolated:src/build/app/outputs/flutter-apk/app-release.apk . # - scp builder@isolated:standalone_app-release.apk.idsig standalone_pro.kherel.selfprivacy_"$APP_BUILD_ID".apk.idsig
environment: # environment:
SSH_PRIVATE_KEY: # SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY # from_secret: SSH_PRIVATE_KEY
#
- name: Sign Release Artifact for Standalone Use # - name: Sign Release Artifact for F-Droid Repository
commands: # commands:
# Get app build ID # # Get app build ID
- export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2` # - export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2`
# Prepare SSH keys # # Prepare SSH keys
- eval `ssh-agent -s` # - eval `ssh-agent -s`
- echo "$SSH_PRIVATE_KEY" | ssh-add - # - echo "$SSH_PRIVATE_KEY" | ssh-add -
# Upload and sign the artifact # # Upload and sign the artifact
- scp app-release.apk builder@isolated:~ # - scp app-release.apk fdroid@isolated:unsigned/pro.kherel.selfprivacy_"$APP_BUILD_ID".apk
- 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" # - ssh fdroid@isolated 'export FDROID_KEY_STORE_PASS=`cat /run/secrets/fdroid-keystore-pass` && fdroid publish && fdroid update'
# Fetch the signed artifact # - scp -r fdroid@isolated:repo .
- scp builder@isolated:standalone_app-release.apk standalone_pro.kherel.selfprivacy_"$APP_BUILD_ID".apk # environment:
- scp builder@isolated:standalone_app-release.apk.idsig standalone_pro.kherel.selfprivacy_"$APP_BUILD_ID".apk.idsig # SSH_PRIVATE_KEY:
environment: # from_secret: SSH_PRIVATE_KEY
SSH_PRIVATE_KEY: #
from_secret: SSH_PRIVATE_KEY # - name: Create Release on Gitea Repository
# commands:
- name: Sign Release Artifact for F-Droid Repository # # Get app build ID
commands: # - export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2`
# Get app build ID # # Prepare tea CLI
- export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2` # - tea login add --token "$GITEA_RELEASE_TOKEN" --url https://git.selfprivacy.org
# Prepare SSH keys # # Create release and push artifacts
- eval `ssh-agent -s` # - 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
- echo "$SSH_PRIVATE_KEY" | ssh-add - # environment:
# Upload and sign the artifact # GITEA_RELEASE_TOKEN:
- scp app-release.apk fdroid@isolated:unsigned/pro.kherel.selfprivacy_"$APP_BUILD_ID".apk # from_secret: GITEA_RELEASE_TOKEN
- ssh fdroid@isolated 'export FDROID_KEY_STORE_PASS=`cat /run/secrets/fdroid-keystore-pass` && fdroid publish && fdroid update' #
- scp -r fdroid@isolated:repo . # - name: Deploy F-Droid Repository
environment: # commands:
SSH_PRIVATE_KEY: # # Prepare SSH keys
from_secret: SSH_PRIVATE_KEY # - eval `ssh-agent -s`
# - echo "$SSH_PRIVATE_KEY" | ssh-add -
- name: Create Release on Gitea Repository # # Copy the repository to the production server
commands: # - scp -r repo/* deployer@production:/var/www/fdroid.selfprivacy.org
# Get app build ID # environment:
- export APP_BUILD_ID=`yq '.version' pubspec.yaml | cut -d "+" -f2` # SSH_PRIVATE_KEY:
# Prepare tea CLI # from_secret: SSH_PRIVATE_KEY
- tea login add --token "$GITEA_RELEASE_TOKEN" --url https://git.selfprivacy.org #
# Create release and push artifacts #trigger:
- 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 # event:
environment: # - tag
GITEA_RELEASE_TOKEN: #
from_secret: GITEA_RELEASE_TOKEN #node:
# server: builder
- name: Deploy F-Droid Repository
commands:
# Prepare SSH keys
- eval `ssh-agent -s`
- echo "$SSH_PRIVATE_KEY" | ssh-add -
# Copy the repository to the production server
- scp -r repo/* deployer@production:/var/www/fdroid.selfprivacy.org
environment:
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
trigger:
event:
- tag
node:
server: builder