24 days ago
I currently have PR preview builds enabled.
However, I'm finding that this isn't sufficient enough for my usecases.
How can I manually control my PR preview builds using GHA?
I want to be able to do so since I have multiple deployments (across different providers) that I want to coordinate and run jobs based on the status said deployments in my workflows.
I've seen https://blog.railway.com/p/github-actions to deploy to a service, but that doesn't cover the topic of dynamic, ephemeral deployments that will be torn down.
1 Replies
24 days ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open Railway • 24 days ago
24 days ago
The short answer is to use the Railway CLI from within your actions.
You can do pretty much anything you want within Railway via the CLI at this point.
Simple example of ephemeral PR environments via GHA
If you want a simple template, you can start by checking out this action from the docs.
It seems to do pretty much exactly what you're describing and spins up / spins down environments manually via GHA.
Expanding out via GHA
Past that, I would suggest downloading the Railway CLI and just running a railway --help and reading through the commands.
If you need specific things to happen on PR open vs PR close for ephemeral environments, it should be pretty trivial via the CLI to achieve whatever you need.
Just make sure your action has access to a secret / environment variable containing a Project or Account Level API key. From there, you should be able to get something together relatively easily 
Out of curiosity, is there something specifically you're trying to achieve that the OOTB experience doesn't provide?