2020-04-16 00:09:29 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-09-27 02:21:29 +08:00
|
|
|
# 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; }
|
2020-04-16 00:09:29 +08:00
|
|
|
|
2021-11-01 04:26:08 +08:00
|
|
|
# Update the docker container. curl is an outdated version which has to be updated.
|
|
|
|
apt update
|
2021-11-01 15:00:52 +08:00
|
|
|
apt upgrade curl -y
|
2021-11-01 04:26:08 +08:00
|
|
|
|
2020-04-16 00:09:29 +08:00
|
|
|
KEYFILE=$(mktemp)
|
2020-09-27 02:21:29 +08:00
|
|
|
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}
|
2020-04-16 00:09:29 +08:00
|
|
|
|
|
|
|
/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")
|