diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/deploy-snapshot.sh | 13 | ||||
-rwxr-xr-x | scripts/encrypt-secret.sh | 15 | ||||
-rwxr-xr-x | scripts/signing-cleanup.sh | 8 | ||||
-rwxr-xr-x | scripts/signing-setup.sh | 16 |
4 files changed, 52 insertions, 0 deletions
diff --git a/scripts/deploy-snapshot.sh b/scripts/deploy-snapshot.sh new file mode 100755 index 00000000..80606f67 --- /dev/null +++ b/scripts/deploy-snapshot.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh +set -ex + +export SSHDIR="$HOME/.ssh" +mkdir -p "$SSHDIR" +echo "$ACTIONS_DEPLOY_KEY" > "$SSHDIR/key" +chmod 600 "$SSHDIR/key" +export SERVER_DEPLOY_STRING="$SSH_USERNAME@$SERVER_ADDRESS:$SERVER_DESTINATION" +mkdir -p "$GITHUB_WORKSPACE/APS" +cp -v ./app/build/outputs/apk/free/release/*.apk "$GITHUB_WORKSPACE/APS/" +cp -v ./app/build/outputs/apk/nonFree/release/*.apk "$GITHUB_WORKSPACE/APS/" +cd "$GITHUB_WORKSPACE/APS" +rsync -ahvcr --omit-dir-times --progress --delete --no-o --no-g -e "ssh -i $SSHDIR/key -o StrictHostKeyChecking=no -p $SSH_PORT" . "$SERVER_DEPLOY_STRING" diff --git a/scripts/encrypt-secret.sh b/scripts/encrypt-secret.sh new file mode 100755 index 00000000..7c762d19 --- /dev/null +++ b/scripts/encrypt-secret.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -ex + +# Simple script that uses OpenSSL to encrypt a provided file with a provided key, and writes the result +# to the provided path. Yes it's very needy. + +INPUT_FILE=$1 +OUTPUT_FILE=$2 +ENCRYPT_KEY=$3 + +if [[ -n "$ENCRYPT_KEY" && -n "$INPUT_FILE" && -n "$OUTPUT_FILE" ]]; then + openssl enc -aes-256-cbc -md sha256 -pbkdf2 -e -in "${INPUT_FILE}" -out "${OUTPUT_FILE}" -k "${ENCRYPT_KEY}" +else + echo "Usage: ./encrypt-secret.sh <input file> <output file> <encryption key>" +fi diff --git a/scripts/signing-cleanup.sh b/scripts/signing-cleanup.sh new file mode 100755 index 00000000..d529c4e9 --- /dev/null +++ b/scripts/signing-cleanup.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -ex + +# Delete Release key +rm -f keystore.jks + +# Delete signing config +rm -f keystore.properties diff --git a/scripts/signing-setup.sh b/scripts/signing-setup.sh new file mode 100755 index 00000000..362ec583 --- /dev/null +++ b/scripts/signing-setup.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e + +ENCRYPT_KEY=$1 + +declare -A SECRETS +SECRETS[secrets/keystore.cipher]=keystore.jks +SECRETS[secrets/props.cipher]=keystore.properties + +if [[ -n "$ENCRYPT_KEY" ]]; then + for src in "${!SECRETS[@]}"; do + openssl enc -aes-256-cbc -md sha256 -pbkdf2 -d -in "${src}" -out "${SECRETS[${src}]}" -k "${ENCRYPT_KEY}" + done +else + echo "Usage: ./signing-setup.sh <encryption key>" +fi |