R
Railway12mo ago
bephrem

GitHub account is already connected to a Railway account

Hi - I'm trying to add a service to a project via GitHub. I'm following a flow as follows: (1) [click] "Add a Service" pane (2) [click] "GitHub Repo" list item (3) [click] "Login with GitHub" button Then I get the error "GitHub account is already connected to a Railway account". It would be great if you could connect a single github account to multiple railway accounts. While you can just create multiple teams & share your team members to them, sometimes you'd want the org itself to have a personal account which originates the team (vs the ownership of the team tying back to your personal email / railway account)
No description
14 Replies
Percy
Percy12mo ago
Project ID: dcbbcdb7-cd29-4c80-9a47-6a3f66851471
Brody
Brody12mo ago
sorry railway only supports connecting a single github account to a single railway account right now
bephrem
bephrem12mo ago
It'd be great to be able to have the same github acct connected to multiple Railway accounts 🙂 from a workflow perspective right now not sure how to auto-deploy via Github unless I explicitly write my own Github action I think I'll just deploy by hand for now - looks like I cant reassociate my github away from that original account
Brody
Brody12mo ago
if I may ask, why do you need multiple github accounts per railway account? I think it should be the other way around actually, a railway account per github account
bephrem
bephrem12mo ago
Oh no it is the same github account connected to multiple railway accounts I have 2 organizations each with Railway accounts (as well as a Railway account under my own personal email - I believe) My github acct controls both Github orgs (which control the private repositories) So the only way I can auto-connect GitHub for auto-pushes is to break the 1-1 mapping w/ Vercel I can connect my github to multiple accounts for auto-deployment Would be really great to have this - without the ability to setup CD in 1-click sort of reduces the magic of things
bephrem
bephrem12mo ago
Tried one-off connecting under General > Service Source (vs connecting my Github to my whole account). It lets me go through the permission flow with Github in a window but then when the window closes nothing happens & it continues to say "There's no remote repository linked to this service"
No description
Brody
Brody12mo ago
for the time being, this is just how it is
bephrem
bephrem12mo ago
No description
bephrem
bephrem12mo ago
Will look into a custom github action 👍 (via https://blog.railway.app/p/github-actions)
bephrem
bephrem12mo ago
No description
bephrem
bephrem12mo ago
name: Deploy to Production on Railway

on:
push:
branches: [master]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node 12
uses: actions/setup-node@v1
with:
node-version: 12.x

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

- name: Deploy
run: railway up
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_PROD }}
name: Deploy to Production on Railway

on:
push:
branches: [master]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node 12
uses: actions/setup-node@v1
with:
node-version: 12.x

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

- name: Deploy
run: railway up
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_PROD }}
investigating why this is failing ah looks like i need node 16 (lemme try node-version: 16.x)
Brody
Brody12mo ago
you will also want to specify a service in the railway up command
~ railway up --help
Upload and deploy project from the current directory

Usage: railway up [OPTIONS] [PATH]

Arguments:
[PATH]

Options:
-d, --detach Don't attach to the log stream
-s, --service <SERVICE> Service to deploy to (defaults to linked service)
-e, --environment <ENVIRONMENT> Environment to deploy to (defaults to linked environment)
--json Output in JSON format
-h, --help Print help
-V, --version Print version
~ railway up --help
Upload and deploy project from the current directory

Usage: railway up [OPTIONS] [PATH]

Arguments:
[PATH]

Options:
-d, --detach Don't attach to the log stream
-s, --service <SERVICE> Service to deploy to (defaults to linked service)
-e, --environment <ENVIRONMENT> Environment to deploy to (defaults to linked environment)
--json Output in JSON format
-h, --help Print help
-V, --version Print version
bephrem
bephrem12mo ago
final working action script (edited):
name: Deploy to Production on Railway

on:
push:
branches: [master]

jobs:
deploy:
runs-on: ubuntu-latest

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

- name: Use Node 19
uses: actions/setup-node@v4
with:
node-version: 19.x

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

- name: Deploy
run: railway up --service ${{ secrets.RAILWAY_SERVICE_ID_PROD }} --environment production
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_PROD }}
name: Deploy to Production on Railway

on:
push:
branches: [master]

jobs:
deploy:
runs-on: ubuntu-latest

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

- name: Use Node 19
uses: actions/setup-node@v4
with:
node-version: 19.x

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

- name: Deploy
run: railway up --service ${{ secrets.RAILWAY_SERVICE_ID_PROD }} --environment production
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_PROD }}
Brody
Brody12mo ago
{__redacted-service-id__} use a variable the same way you do for the token
Want results from more Discord servers?
Add your server