Deploy from connected image not triggering?

tiltowait
HOBBY

9 months ago

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

0 Replies

9 months 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
HOBBY

9 months ago

Oh, that’s a shame. What’s the recommended workflow?


9 months 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
HOBBY

9 months ago

I liked the idea of deploying on tag creation vs a push to a branch


9 months ago

fair enough


9 months ago

i assume you have a gh action to build an image right?


tiltowait
HOBBY

9 months ago

Yes


9 months ago

does this action create an image with a different tag every time it builds an image?


tiltowait
HOBBY

9 months ago

Yes, but also updates latest


9 months ago

would you settle for deploying the service from latest when a new image is published?


tiltowait
HOBBY

9 months ago

Tbh that’s what I thought I was doing, or at least attempting


9 months ago

well if you are okay with that, you could call railway redeploy in an action?


9 months ago

in an action that runs after a successful image has been built that is


tiltowait
HOBBY

9 months ago

Ah, sure, I can do that


tiltowait
HOBBY

9 months ago

Thanks


9 months ago

youd just need the project token -
and then railway redeploy -y --service


tiltowait
HOBBY

9 months ago

Thanks. I’ll look into it!


9 months ago

let me know if you get stuck!


tiltowait
HOBBY

9 months 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 
      env:
        RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}

9 months 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 ``


tiltowait
HOBBY

9 months ago

Okay, wasn't sure if the service ID should be secret or not


9 months ago

nope, its just a uuid


tiltowait
HOBBY

9 months ago

the docker image for the cli

Do you mean my docker image, or is there a Railway image?


9 months ago

this one -


tiltowait
HOBBY

9 months ago

deploy:
  needs: build
  runs-on: ubuntu-latest
  container: ghcr.io/railwayapp/cli:latest
  env:
    SVC_ID: 
    RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}

  steps:
    - name: Deploy new image
      run: railway redeploy -y --service ${{ env.SVC_ID }}

9 months 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
HOBBY

9 months ago

the example had the runs-on

1298144323585441800


9 months 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
HOBBY

9 months ago

Sure. Will probably be a couple of days before my next deployment 👍


tiltowait
HOBBY

9 months ago


9 months ago

you can still trigger that action via a button though right?


tiltowait
HOBBY

9 months ago

Yeah, this is just the job. I cut out the rest of the workflow, which triggers on tag creation


9 months ago

then the example on our repo is likely correct


tiltowait
HOBBY

9 months ago

Cool, thanks for the help. I'll let you know if it works


tiltowait
HOBBY

9 months ago

(In case it helps anyone else trying the same thing)


9 months ago

sounds good!


tiltowait
HOBBY

9 months ago

@Brody the redeployment triggers work 🙂 (Though they didn't behave as I wanted this time, because my last deployment was via railway up, not Docker, so it didn't actually get the new code. I addressed that, so hopefully it will work correctly moving forward)

1299535699590119400


9 months ago

yeah it's only going to deploy whatever the most recent deployment is, of you wanna redeploy from source you will need to call the API manually


tiltowait
HOBBY

9 months ago

Yep, makes sense


tiltowait
HOBBY

9 months ago

It took a moment to figure out how to redeploy via image. I thought unlinking then re-linking would do it, but I had to click redeploy from the original docker deployment


9 months ago

well I'm glad you've solved this


Deploy from connected image not triggering? - Railway Help Station