Compare commits

..

1 Commits
main ... 1.0.23

Author SHA1 Message Date
Don Cote
4419d1140e handle secrets and db startup 2022-09-07 13:15:20 -04:00

View File

@ -2,6 +2,9 @@
set -ex
pwd
ls -la
PR_NUMBER=$(jq -r .number /github/workflow/event.json)
if [ -z "$PR_NUMBER" ]; then
echo "This action only supports pull_request actions."
@ -15,7 +18,6 @@ EVENT_TYPE=$(jq -r .action /github/workflow/event.json)
# Default the Fly app name to pr-{repo}-{title}-{number}-{user}
app="${INPUT_NAME:-pr-$REPO_NAME-$PR_TITLE-$PR_NUMBER-$USER}"
app=$(echo $app | tr '[:upper:]' '[:lower:]')
region="${INPUT_REGION:-${FLY_REGION:-iad}}"
org="${INPUT_ORG:-${FLY_ORG:-personal}}"
image="$INPUT_IMAGE"
@ -45,13 +47,11 @@ if [ -n "$INPUT_POSTGRES" ]; then
flyctl postgres attach "$INPUT_POSTGRES" --app "$app" --database-name "$app"-db || true
fi
# Set up secrets
if [ -n "$INPUT_SECRETS" ]; then
echo "Setting secrets."
echo $INPUT_SECRETS | tr " " "\n" | flyctl secrets import --app "$app"
fi
# Deploy the app
if [ "$INPUT_UPDATE" != "false" ]; then
echo "Deploying the app."
flyctl deploy --config "$INPUT_CONFIG" --app "$app" --region "$region" --strategy immediate --image "$image" --remote-only