Deploy from connected image not triggering?

I have my deployment connected to an image in ghcr.io. The first time I deployed, it worked fine; however, I just published a new image a few minutes ago, and Railway hasn't picked it up. Does it just take some time? 12fe90d4-42ca-4704-980b-e16da59696c0
33 Replies
Percy
Percy10h ago
Project ID: 12fe90d4-42ca-4704-980b-e16da59696c0
Brody
Brody9h ago
we unfortunately do not monitor for newly published images, simply because there is no good way to do that, with GitHub repos, GitHub sends a webhook, but that doesn't happen when new images are publishing
tiltowait
tiltowait9h ago
Oh, that’s a shame. What’s the recommended workflow?
Brody
Brody9h ago
Well I'd first have to ask, why not simply attach the GitHub repo to the railway service and let railway build and deploy the image?
tiltowait
tiltowait9h ago
I liked the idea of deploying on tag creation vs a push to a branch
Brody
Brody9h ago
fair enough i assume you have a gh action to build an image right?
tiltowait
tiltowait9h ago
Yes
Brody
Brody8h ago
does this action create an image with a different tag every time it builds an image?
tiltowait
tiltowait8h ago
Yes, but also updates latest
Brody
Brody8h ago
would you settle for deploying the service from latest when a new image is published?
tiltowait
tiltowait8h ago
Tbh that’s what I thought I was doing, or at least attempting
Brody
Brody8h ago
well if you are okay with that, you could call railway redeploy in an action? in an action that runs after a successful image has been built that is
tiltowait
tiltowait8h ago
Ah, sure, I can do that Thanks
Brody
Brody8h ago
youd just need the project token - https://docs.railway.app/guides/cli#tokens and then railway redeploy -y --service <service_id>
tiltowait
tiltowait8h ago
Thanks. I’ll look into it!
Brody
Brody8h ago
let me know if you get stuck!
tiltowait
tiltowait5h ago
Would this be correct?
deploy:
needs: build
runs-on: ubuntu-latest

steps:
- name: Use Node 22
uses: action/setup-node@v4
with:
node-version: 22.x

- name: Install Railway
run: npm i -g @railway/cli

- name: Deploy
run: railway redeploy -y --service <service_id>
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
deploy:
needs: build
runs-on: ubuntu-latest

steps:
- name: Use Node 22
uses: action/setup-node@v4
with:
node-version: 22.x

- name: Install Railway
run: npm i -g @railway/cli

- name: Deploy
run: railway redeploy -y --service <service_id>
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
Brody
Brody5h ago
i honestly dont know the syntax for github actions off the top of my head, but id use the docker image for the cli and an environment variable for <service_id>
tiltowait
tiltowait5h ago
Okay, wasn't sure if the service ID should be secret or not
Brody
Brody5h ago
nope, its just a uuid
tiltowait
tiltowait5h ago
the docker image for the cli
Do you mean my docker image, or is there a Railway image?
tiltowait
tiltowait5h ago
deploy:
needs: build
runs-on: ubuntu-latest
container: ghcr.io/railwayapp/cli:latest
env:
SVC_ID: <blah>
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}

steps:
- name: Deploy new image
run: railway redeploy -y --service ${{ env.SVC_ID }}
deploy:
needs: build
runs-on: ubuntu-latest
container: ghcr.io/railwayapp/cli:latest
env:
SVC_ID: <blah>
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}

steps:
- name: Deploy new image
run: railway redeploy -y --service ${{ env.SVC_ID }}
Brody
Brody5h ago
do you still need runs-on if you are providing the image? I genuinely don't know, and I'd still use a GitHub secret for the service id, while it's not sensitive, I'd image updating the service id via there GitHub UI is going to be easier / more efficient than editing the action file
tiltowait
tiltowait5h ago
the example had the runs-on
No description
Brody
Brody5h ago
fair, a team member didn't write that, so I'm not sure if it's correct, would you mind fact checking that?
tiltowait
tiltowait5h ago
Sure. Will probably be a couple of days before my next deployment 👍
Brody
Brody5h ago
you can still trigger that action via a button though right?
tiltowait
tiltowait5h ago
Yeah, this is just the job. I cut out the rest of the workflow, which triggers on tag creation
Brody
Brody5h ago
then the example on our repo is likely correct
tiltowait
tiltowait5h ago
Cool, thanks for the help. I'll let you know if it works (In case it helps anyone else trying the same thing)
Brody
Brody5h ago
sounds good!
Want results from more Discord servers?
Add your server