Heyo!
I followed the Staging environments on the Fly with GitHub actions guide, and I have the GitHub action up and running. However, I appear to need another step to make the preview deploy successful. Since superfly/fly-pr-review-apps
differs from superfly/flyctl-actions/setup-flyctl
, I’m not sure what to do.
+ '[' -n ]
+ jq -r .number /github/workflow/event.json
+ PR_NUMBER=72
+ '[' -z 72 ]
+ [REDACTED]
+ jq -r .action /github/workflow/event.json
+ EVENT_TYPE=synchronize
+ [REDACTED]
+ [REDACTED]
+ region=dfw
pr-72-[REDACTED]
+ org=personal
+ image=
+ config=fly_staging.toml
+ echo pr-72-[REDACTED]
+ grep 72
+ '[' synchronize '=' closed ]
+ flyctl status --app pr-72-[REDACTED]
Error: failed to get app: Could not find App "pr-72-[REDACTED]"
+ cp fly_staging.toml fly_staging.toml.bak
+ flyctl launch --no-deploy --copy-config --name pr-72-[REDACTED] --image --region dfw --org personal
An existing fly.toml file was found for app [REDACTED]
Error: We've identified an Elixir Project but when attempting to compile it we ran into an error. Please check that your Elixir project builds successfully and try again.: exec: "mix": executable file not found in $PATH
Also, I noticed that this deploy was triggering before CI was complete. To my mind, the staging deploy should only be triggered after a successful CI run, so I tried using a trigger from my prod deploy action:
on:
workflow_run:
workflows: ["Elixir CI"]
types:
- completed
However, this doesn’t trigger the staging action even when the Elixir CI workflow completes successfully.
TLDR:
- How do I deploy an Elixir app to a PR preview machine using
superfly/fly-pr-review-apps
? - How can I ensure that staging deploys are only triggered after CI passes?
Thank you for the article, Mariusz.