1
0
mirror of https://codeberg.org/gitnex/GitNex synced 2024-12-24 01:23:41 +01:00
GitNex-Android-App/scripts/sign-build.sh
qwerty287 471889f744 Fix CI (#1010)
* replace docker image with newer version (tested locally, `curl` and `apksigner` are available)
* update the container before signing. This is necessary because `curl` is outdated, but can be updated via `apt` (tested locally, working **only** after update)

I hope this way is fine, I don't really anything about docker and just tried to fix it :)

Co-authored-by: qwerty287 <ndev@web.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1010
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2021-10-31 21:26:08 +01:00

20 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# 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; }
# Update the docker container. curl is an outdated version which has to be updated.
apt update
apt upgrade curl
KEYFILE=$(mktemp)
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")