Github Actions Post Deploy after complete project finished deploying
haberkamp
PROOP

a month ago

I found this article of yours: https://docs.railway.com/tutorials/github-actions-post-deploy

It looks like it fires every time a single service finished deploying.

My goal: Trigger a GitHub action that only runs when both services successfully deployed.

$10 Bounty

4 Replies

Railway
BOT

a month ago


sarahkb125
EMPLOYEE

a month ago

Hi there,

I have opened up this thread to the community.

Best,

The Railway Team


To do this you'd have to create a separate workflow that waits for both post-deploy events, perhaps by using a status file/job dependency before running your action. you can configure your own workflow to check both service states (via artifacts or cache) and return success if it completed it.

read this or this to better understand how to do it


fra
HOBBY

a month ago

If I understood correctly you have 2 services that you want to deploy, and once they are both deployed you want to do something else, right?
If this is what you need then something like this:

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

        steps:
            - name: Checkout code
              uses: actions/checkout@v4

            - name: Deploy Service 1 to Railway and wait using -c
              run: railway up -c --service=service-1

            - name: Deploy Service 2 to Railway
              run: railway up -c --service=service-2

            - name: Whatever you need
              run: ....

should work, the -c wait for the service to be deployed


Loading...