Apk signing pipeline job

Signed-off-by: Balazs Toldi <balazs@toldi.eu>
This commit is contained in:
Balazs Toldi 2023-07-26 07:38:50 +02:00
parent 333d59ade4
commit 5181134253
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
2 changed files with 18 additions and 2 deletions

View File

@ -2,15 +2,22 @@ pipeline:
build: build:
image: alvrme/alpine-android:android-33-jdk11 image: alvrme/alpine-android:android-33-jdk11
commands: commands:
- ./gradlew :app:assemble - ./gradlew :app:assembleRelease
when: when:
path: [ app/**, build.gradle ] path: [ app/**, build.gradle ]
sign:
image: alvrme/alpine-android:android-33-jdk11
commands:
- ./scripts/apk-sign.sh LemmInfinity-signed.apk app/build/outputs/apk/release/app-release-unsigned.apk
secrets: [ APK_KS_PASS, APK_KS, APK_KS_ALIAS ]
when:
event: [ tag ]
publish: publish:
image: woodpeckerci/plugin-gitea-release image: woodpeckerci/plugin-gitea-release
settings: settings:
base_url: https://codeberg.org base_url: https://codeberg.org
files: files:
- app/build/outputs/apk/release/app-release-unsigned.apk - LemmInfinity-signed.apk
api_key: api_key:
from_secret: GITEA_ACCESS_TOKEN from_secret: GITEA_ACCESS_TOKEN
target: main target: main

9
scripts/apk-sign.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
[ -z "${APK_KS_PASS}" ] && { echo "Missing keystore password (KS_PASS)"; exit 1; }
[ -z "${APK_KS}" ] && { echo "Missing keystore file (KS)"; exit 1; }
[ -z "${APK_KS_ALIAS}" ] && { echo "Missing keystore alias (KS_ALIAS)"; exit 1; }
echo -n "$APK_KS" | base64 -d > /tmp/keystore.keystore
apksigner sign --ks /tmp/keystore.keystore --ks-pass pass:${APK_KS_PASS} --ks-key-alias ${APK_KS_ALIAS} --out $1 $2