mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-11 09:15:56 +00:00
Jakub Sokołowski
acfa73ab43
This has several benefits: * Less abuse of `extra-sandbox-paths` Nix option * Less inputs to the Android release build derivation * Easier for users to sign the build themselves * Simplification of `scripts/release-android.sh` * Preparation for building using Nix Flakes The only two remaining credentials passed via `extra-sandbox-paths` is the Infura and OpenSea API keys, and there is no way around that other than passing them via Nix arguments, but that would cause them to end up in `/nix/store` as part of `.drv` files. I'm also renaming `release-fdroid` to `build-fdroid` to be consistent. Depends on: https://github.com/status-im/status-jenkins-lib/pull/42 Signed-off-by: Jakub Sokołowski <jakub@status.im>
49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
|
source "${GIT_ROOT}/scripts/colors.sh"
|
|
|
|
function property() {
|
|
grep "${2}" "${1}" | cut -d'=' -f2
|
|
}
|
|
|
|
function gradle_property() {
|
|
property ${GIT_ROOT}/android/gradle.properties ${1}
|
|
}
|
|
|
|
function env_var_or_gradle_prop() {
|
|
VAR_NAME="${1}"
|
|
if [[ -n "${!VAR_NAME}" ]]; then
|
|
echo "${!VAR_NAME}"
|
|
else
|
|
gradle_property "${VAR_NAME}"
|
|
fi
|
|
}
|
|
|
|
function must_get_env() {
|
|
declare -n VAR_VALUE="$1"
|
|
if [[ -n "${VAR_VALUE}" ]]; then
|
|
echo "${VAR_VALUE}"
|
|
return
|
|
fi
|
|
echo -e "${RED}No required env variable:${RST} ${BLD}${!VAR_VALUE}${RST}" 1>&2
|
|
exit 1
|
|
}
|
|
|
|
# If filename contains string "unsigned" change that to signed.
|
|
# Otherwise sign in-place and overwrite the current unsigned file.
|
|
if [[ "${1}" =~ unsigned ]]; then
|
|
OUTPUT_FLAGS="--out=${1/unsigned/signed}"
|
|
fi
|
|
|
|
echo -e "${GRN}Signing APK:${RST} ${1}" >&2
|
|
|
|
exec apksigner sign --verbose \
|
|
--ks="$(env_var_or_gradle_prop KEYSTORE_PATH)" \
|
|
--ks-pass="pass:$(env_var_or_gradle_prop KEYSTORE_PASSWORD)" \
|
|
--ks-key-alias="$(env_var_or_gradle_prop KEYSTORE_ALIAS)" \
|
|
--key-pass="pass:$(env_var_or_gradle_prop KEYSTORE_KEY_PASSWORD)" \
|
|
"${OUTPUT_FLAGS}" \
|
|
"${1}"
|