Browse Source

Fixing CI (#710)

Fixing CI.

Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/710
Reviewed-by: 6543 <6543@noreply.codeberg.org>
pull/711/head
opyale 10 months ago
committed by 6543
parent
commit
01bd61ad8e
  1. 4
      .drone.yml
  2. 4
      .gitlab-ci.yml
  3. 19
      scripts/sign-build.sh

4
.drone.yml

@ -66,7 +66,7 @@ steps:
- name: build
image: nextcloudci/android:android-49
commands:
- ./gradlew build
- ./gradlew assembleFreeRelease
- name: sign
image: nextcloudci/android:android-49
@ -78,7 +78,7 @@ steps:
KEY_PASS:
from_secret: KEY_PASS
OUTPUT: signed.apk
GITEA: https://gitea.com
INSTANCE: https://codeberg.org
KS_FILE: ci_keystore.jks
KS_REPO:
from_secret: KS_REPO

4
.gitlab-ci.yml

@ -20,7 +20,7 @@ build:
- master
- tags
script:
- ./gradlew build
- ./gradlew assembleFreeRelease
artifacts:
paths:
- app/build/outputs/
@ -34,7 +34,7 @@ sign:
- tags
variables:
OUTPUT: "signed.apk"
GITEA: "https://gitea.com"
INSTANCE: "https://codeberg.org"
KS_FILE: "ci_keystore.jks"
script:
- ./scripts/sign-build.sh

19
scripts/sign-build.sh

@ -1,16 +1,15 @@
#!/usr/bin/env bash
#make sure needed var's are here
[ -z "${BOT_TOKEN}" ] && { echo "missing BOT_TOKEN"; exit 1; }
[ -z "${KS_PASS}" ] && { echo "missing KS_PASS"; exit 1; }
[ -z "${KEY_PASS}" ] && { echo "missing KEY_PASS"; exit 1; }
[ -z "${GITEA}" ] && { echo "missing GITEA"; exit 1; }
[ -z "${KS_REPO}" ] && { echo "missing KS_REPO"; exit 1; }
[ -z "${KS_FILE}" ] && { echo "missing KS_FILE"; exit 1; }
[ -z "${OUTPUT}" ] && { echo "missing OUTPUT"; exit 1; }
# Make sure needed var's are here
[ -z "${BOT_TOKEN}" ] && { echo "Token is missing (BOT_TOKEN)"; exit 1; }
[ -z "${KS_PASS}" ] && { echo "Missing keystore password (KS_PASS)"; exit 1; }
[ -z "${KEY_PASS}" ] && { echo "Missing KEY_PASS"; exit 1; }
[ -z "${INSTANCE}" ] && { echo "Instance url is missing (INSTANCE)"; exit 1; }
[ -z "${KS_REPO}" ] && { echo "Missing repo of keystore (KS_REPO)"; exit 1; }
[ -z "${KS_FILE}" ] && { echo "Filename of keystore is missing (KS_FILE)"; exit 1; }
[ -z "${OUTPUT}" ] && { echo "Missing filename of signed output (OUTPUT)"; exit 1; }
KEYFILE=$(mktemp)
curl -X GET "${GITEA}/api/v1/repos/${KS_REPO}/contents/${KS_FILE}?token=${BOT_TOKEN}" -H "accept: application/json" | sed 's|"content":"|#|g' | cut -d '#' -f 2 | cut -d '"' -f 1 | base64 -d > ${KEYFILE}
curl -X GET "${INSTANCE}/api/v1/repos/${KS_REPO}/contents/${KS_FILE}?token=${BOT_TOKEN}" -H "accept: application/json" | sed 's|"content":"|#|g' | cut -d '#' -f 2 | cut -d '"' -f 1 | base64 -d > ${KEYFILE}
/opt/android-sdk-linux/build-tools/*/apksigner sign -v --ks-pass pass:$KS_PASS --key-pass pass:$KEY_PASS --ks-key-alias GitNexBot --ks ${KEYFILE} --out signed.apk $(find . -name "*release*.apk")
Loading…
Cancel
Save