Deployment with actions
matthew-cameron1
PROOP

10 months ago

Hey! I have a main branch I’d like to make PRs into that is connected to auto deploy for a staging / testing environment. However right now, I have to use a second branch called develop to merge into then constantly merge that to main keeping them in sync.

Is there a way to deploy using actions workflow for say a release created that I can use for prod deployments while leaving the auto deployment for the test environment ?

Solved

0 Replies

matthew-cameron1
PROOP

10 months ago

N/A


brody
EMPLOYEE

10 months ago

can you share the project id so i can get a better idea of your current setup


matthew-cameron1
PROOP

10 months ago

Sory Brody, bit of a delay here 4359f6f8-66c9-406b-92b1-bf8866d6426a


maddsua
HOBBY

10 months ago

U can use GH actions to trigger a deploy job when the rules match, for instance, you can skip all commit events and only deploy on tag push. It would be something like:

on:
  push:
    tags:
      - "v*.*.*"

deploy-job:
  runs-on: ubuntu-latest
  container: ghcr.io/railwayapp/cli:latest
  env:
    SVC_ID: my-service
    ENV_ID: my-env
    RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
  steps:
    - uses: actions/checkout@v4
    - run: railway up --service=${{ env.SVC_ID }} --environment=${{ env.ENV_ID }}

maddsua
HOBBY

10 months ago

In this example the deploy job would only run when a tag like v1.2.3 is pushed


matthew-cameron1
PROOP

10 months ago

I figured it could be possible I have just not tried out the CLI! This is amazing


matthew-cameron1
PROOP

10 months ago

Can start developing off the main branch a bit cleaner, making some smaller PR's and only deploy once we are ready


matthew-cameron1
PROOP

10 months ago

Huge thanks


maddsua
HOBBY

10 months ago

🫡


brody
EMPLOYEE

10 months ago

!s


Status changed to Solved brody 10 months ago


Loading...