Deploy using CI/CD Github Actions
I created a simple script to deploy my backend using github actions and workflow. Could someone help me?
Deploy do Backend na Railway
deploy-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'
- name: Install Railway CLI
run: npm install -g @railway/cli
- name: Inject Railway Token
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
run: echo "RAILWAY_TOKEN is set up."
- name: Deploy Backend on Railway
working-directory: ./packages/backend
run: railway up
19 Replies
Project ID:
N/A
what seems to be the issue?
Well, you could skip the entire install node/cli part by using the docker image directly
Also, you need to provide service name using the respective flag
I am looking to create a script with CI to deploy just the backend on railway. I created a Monorepo and the frontend is on vercel and backend should be in Railway
two major differences are:
1. use docker image directly instead of installing the cli via npm
2.
--service
flag that tells to which service to deployAwesome I will 😄
well, this should work without an issue
this is how I deploy my stuff to railway
you'd only need to update working directory to the one containing your actual code
Run railway up --project=1838b8e6-6a84-4a60-9033-3b38888c4746
error: unexpected argument '--project' found
tip: to pass '--project' as a value, use '-- --project'
Usage: railway up [OPTIONS] [PATH]
For more information, try '--help'.
Error: Process completed with exit code 2.
I received this error on Github CI terminal
may I ask what's the
--project
argument doing there?
I don't think the cli even has an arg like that
when running in ci mode you need to provide project token with RAILWAY_TOKEN
env var and a service name with --service
argumentRun railway up --service=1838b8e6-6a84-4a60-9033-3b38888c4746
Service not found
Error: Process completed with exit code 1.
honestly I don't remember if we support account-scoped access tokens and setting project id via a flag atm
you need to use service name, not it's id
because at the time when I was working on fixing ci mode, adding support for that would involve rewriting too much stuff
Great, helped me. I will change here
could i ask why you arent using the default Railway's build system?
I would like to make a CI in a Monorepo send a project Next to Vercel and Backend on Railway
real
unbelievable but there are people who don't deploy everything to railway
but you can deploy a monorepo on Railway
https://docs.railway.app/guides/monorepo
Okay so do you have a example of CI like a file I sent here?
umm if you wanna use monorepo support you don't need to configure gh actions, it's configured in railway dashboard
you gotta link a repo to a service first, and then play with the settings a bit