Skip to content

Commit

Permalink
modify script
Browse files Browse the repository at this point in the history
  • Loading branch information
saperi22 committed Sep 10, 2024
1 parent ad4ff88 commit f43e9f3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
19 changes: 16 additions & 3 deletions .github/executables/decrypt_secret.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
#!/bin/sh

# Get arguments
while getopts passphrase:input:output: flag
do
case "${flag}" in
passphrase) passphrase=${OPTARG};;
input) input=${OPTARG};;
output) output=${OPTARG};;
esac
done
echo "Passphrase: $passphrase";
echo "Input: $input";
echo "Output: $output";

# Decrypt the file
mkdir $HOME/secrets
# --batch to prevent interactive command
# --yes to assume "yes" for questions
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" \
--output $HOME/secrets/braintree_demo_app-eb501d54ba5f.json \
./.github/files/braintree-demo-app-eb501d54ba5f.json.gpg
gpg --quiet --batch --yes --decrypt --passphrase="$passphrase" \
--output "$output" "$input" \
&& cat "$output"
5 changes: 4 additions & 1 deletion .github/workflows/firebase_deploy_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:
- name: Assemble
run: ./gradlew --stacktrace :demo:assembleRelease
- name: Decrypt large secret
run: ./.github/executables/decrypt_secret.sh
run: ./.github/executables/decrypt_secret.sh \
-passphrase $LARGE_SECRET_PASSPHRASE \
-input ./.github/files/braintree-demo-app-eb501d54ba5f.json.gpg \
-output $HOME/secrets/braintree_demo_app-eb501d54ba5f.json
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.FIREBASE_PRIVATE_KEY_GPG_PASSPHRASE }}
# - name: Deploy to Firebase
Expand Down

0 comments on commit f43e9f3

Please sign in to comment.