惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
V
Visual Studio Blog
Jina AI
Jina AI
博客园 - 【当耐特】
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
I
InfoQ
IT之家
IT之家

Railway Blog

Where Railway is, and where it's going (Summer 2026) PaaS vs IaaS vs SaaS: What Each Means and Who Should Pick What in 2026 The Best Continuous Deployment Tools in 2026 The Best PaaS for Multi-Region Deployments in 2026 The Best Platforms for Monorepo Deployments in 2026 Compliance Isn't a Feature, It's a Posture What is BYOC (Bring Your Own Cloud)? A Developer's Guide for 2026 The Best Managed Kubernetes Hosting in 2026 The Best Container Registries in 2026 The Vanilla Cloud Tax: What Rolling Your Own on AWS Actually Costs What is a PaaS? A Developer's Guide for 2026 The Best Cloud Observability and Logging Tools in 2026 The Best PostgreSQL Hosting for Developers in 2026 The Best Multi-Region Hosting Platforms in 2026 The Best Platforms to Deploy AI Apps in 2026 (Not the Models, the Apps Around Them) Incident Report: May 19, 2026- GCP Account Suspension Counting to 3 with a new builder processing 50M+ monthly builds Railway iOS preview now available via TestFlight Kill your onboarding: selling to 10,000+ new users a day Your AI wants to nuke your database. Guardrails fix that. Better Rails for Agents: A New Remote MCP and Railway Agent in the CLI Moving Railway's Frontend Off Next.js One command deploys, there's a Stripe APP for that From registrar to deployed: buying a domain inside Railway A letter to open source builders who deserve more Networking is a black box, we used eBPF to open it Heroku Walked So Railway Can Run Security Features Your Security Team Will Love Railway Runs Open Source, Now We're Funding It Railway raises $100M Series B to unburden the builders
Using Github Actions with Railway
Faraz Patankar · 2021-06-04 · via Railway Blog

Github Actions come with a pretty neat set of features to automate your workflows. In this post, we talk about using Github Actions to automate your deployments on Railway.


At Railway, we've set up Github triggers so that your app can be automatically deployed when you push to a selected branch within the connected repository. This works for most basic use-cases but after a while, you probably want more control and that's where Github Actions come in.

If you haven't used them before, Github Actions allow you to automate several parts of your development workflow. Think building your app, running some tests, managing pull requests; the possibilities are endless. Recently, within our Discord, we've had a couple of users ask us how they'd go about deploying their app on Railway using Github Actions so we thought it'd be a good idea to publish a short tutorial doing just that.

Project tokens

To interact with your project within Github Actions, you'd have to use the Railway CLI and because you can't really log in to the CLI within a remote server, we allow you to provision project tokens. Project tokens allow the CLI to access all the environment variables associated with a specific project and environment.

You can create a new project token on the Settings page of your project dashboard within the Tokens submenu.

Create project token
Create project token

Once you created your project token, you can add it to your repository secrets on Github by visiting the Secrets submenu under repository settings.

Repository secrets
Repository secrets

Lights, camera, action!

name: Deploy to Railway

on:
  push:
    branches: [main]

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

The action shared above is pretty self-explanatory. Whenever some code is pushed to the main branch, the action is triggered. The deploy job pulls the latest version of the CLI docker image and uses it as a base container. The, the only thing left is to checkout your code and upload it to Railway!

Keep in mind that the RAILWAY_TOKEN must be kept secret, while the service Id can be passed freely as a part of deploy command, or as an environment variable, defined inside the job configuration.

Conclusion

While this was a very basic example of deploying your application on Railway using Github Actions, you can do all sorts of things using the project token. We have users using it to manage pull requests, migrate their database before deploying, and, as shown in this blog post, deploying the application itself.

Let us know if you have any thoughts/feedback regarding this post or would like to see more tutorials using Github Actions. The easiest way to reach us is our Discord server which we also use to run all our internal communications which you can read about in this post.