Skip to content

Commit

Permalink
Merge pull request #6 from mattrigg9/main
Browse files Browse the repository at this point in the history
Add support for a custom Fly config path
  • Loading branch information
mrkurt authored Sep 13, 2022
2 parents 4f72599 + 42d8853 commit c93b4be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ If you have an existing `fly.toml` in your repo, this action will copy it with a
## Inputs

| name | description |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | The name of the Fly app. Alternatively, set the env `FLY_APP`. For safety, must include the PR number. Example: `myapp-pr-${{ github.event.number }}`. Defaults to `pr-{number}-{repo_org}-{repo_name}`. |
| `image` | Optional pre-existing Docker image to use |
| `config` | Optional path to a custom Fly toml config. Config path should be relative to `path` parameter, if specified. |
| `region` | Which Fly region to run the app in. Alternatively, set the env `FLY_REGION`. Defaults to `iad`. |
| `org` | Which Fly organization to launch the app under. Alternatively, set the env `FLY_ORG`. Defaults to `personal`. |
| `path` | Path to run the `flyctl` commands from. Useful if you have an existing `fly.toml` in a subdirectory. |
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ inputs:
description: Fly app name
image:
description: Optional pre-existing Docker image to use
config:
description: Optional path to a custom Fly toml config. Config path should be relative to `path` parameter, if specified.
region:
description: Region to launch the app in (alternatively, set the env FLY_REGION)
org:
Expand Down
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ app="${INPUT_NAME:-pr-$PR_NUMBER-$REPO_OWNER-$REPO_NAME}"
region="${INPUT_REGION:-${FLY_REGION:-iad}}"
org="${INPUT_ORG:-${FLY_ORG:-personal}}"
image="$INPUT_IMAGE"
config="$INPUT_CONFIG"

if ! echo "$app" | grep "$PR_NUMBER"; then
echo "For safety, this action requires the app's name to contain the PR number."
Expand All @@ -38,7 +39,7 @@ fi
if ! flyctl status --app "$app"; then
flyctl launch --now --copy-config --name "$app" --image "$image" --region "$region" --org "$org"
elif [ "$INPUT_UPDATE" != "false" ]; then
flyctl deploy --app "$app" --region "$region" --image "$image" --region "$region" --strategy immediate
flyctl deploy --config "$config" --app "$app" --region "$region" --image "$image" --region "$region" --strategy immediate
fi

# Attach postgres cluster to the app if specified.
Expand Down

0 comments on commit c93b4be

Please sign in to comment.