-
-
Save ramonornela/2e683e4fde6df66dca88972412dc52ef to your computer and use it in GitHub Desktop.
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
_set-env-vars-file: | |
steps: | |
- script: | |
inputs: | |
- title: "Set env vars file" | |
- content: | | |
#!/bin/bash | |
if [ -n "$ENV_FILE" ]; then | |
# specify local download path | |
file_local_path=$BITRISE_SOURCE_DIR/file_env | |
# download the file | |
wget -O "$file_local_path" "$ENV_FILE" | |
filename="$file_local_path" | |
# set vars define by env file in generic file storage | |
while IFS= read -r var | |
do | |
if [[ $var =~ "=" ]]; then | |
key=${var%%=*} | |
value=${var#*=} | |
valueDefault=${!key} | |
if [ -n "$value" ] && [ -z "$valueDefault" ]; then | |
echo "Set var: $key" | |
envman add --key $key --value $value | |
fi | |
fi | |
done < "$filename" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment