Created
September 9, 2021 23:28
-
-
Save jahrmando/fee81b122eab76fdd09781fdf8e477ef to your computer and use it in GitHub Desktop.
Script bash to load .env file to Github Secrets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Usage: ./load_envs_secrets.sh PREFIX(optional) | |
## | |
## | |
PREFIX=${1:-""} | |
while read SECRT ; do | |
if [[ $SECRT =~ ^([A-Z0-9_]*)=(.*) ]]; then | |
S_KEY=${PREFIX}${BASH_REMATCH[1]} | |
S_VALUE=${BASH_REMATCH[2]} | |
echo "Loading value secret: $S_KEY -> $S_VALUE" | |
gh secret set $S_KEY -b"${S_VALUE}" | |
sleep 2 | |
fi | |
done < .env |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment