---
title: "CI/CD"
description: "Preview environments, GitHub Actions, monorepos, config as code and safe rollbacks."
url: https://railway.com/guides/topics/ci-cd
guides: 26
last_updated: 2026-11-05T19:03:19.583Z
---

# CI/CD

Preview environments, GitHub Actions, monorepos, config as code and safe rollbacks.

## Get started

1. [Deploy on Merge with PR Environments as Canaries](https://railway.com/guides/ship-on-merge-pr-canaries.md): Set up a trunk-based promotion workflow on Railway. Every pull request gets a canary environment; every merge to main deploys production automatically.
2. [Deploy from a Private Container Registry](https://railway.com/guides/private-container-registry.md): Deploy Docker images from private registries (GHCR, Docker Hub, GitLab, ECR, Google Artifact Registry) on Railway, from credential setup to CI-driven redeploys.
3. [Running Agents on Railway](https://railway.com/guides/running-agents-on-railway.md): Learn how to deploy always-on, autonomous AI agents on Railway by building a Claude-powered GitHub DevBot that opens pull requests in response to new issues.

## Build and deploy

- [Deploying a Monorepo to Railway](https://railway.com/guides/deploying-a-monorepo.md): Learn how to deploy a monorepo to Railway.
- [Deploying Monorepo Applications](https://railway.com/guides/deploying-monorepos.md): Make use of Railway's custom root directory and run command features to deploy monorepo applications

## Run in production

- [Rotate API Keys and Database Credentials Without Downtime](https://railway.com/guides/rotate-credentials-zero-downtime.md): Use the dual-key overlap pattern, staged redeploys, and reference variables to rotate secrets on Railway with zero downtime.
- [Lock Down a Production Railway Project](https://railway.com/guides/lock-down-production-project.md): Harden a production Railway project with Under Attack Mode, private networking, scoped API tokens, sealed variables, and workspace-level access controls.
- [Manually Optimize Deployments on Railway](https://railway.com/guides/comparing-deployment-methods-in-railway.md): Understand the different methods of deploying to Railway and learn how to speed things up

## Compare and decide

- [Handle Build-Time vs Runtime Secrets in Docker Builds](https://railway.com/guides/build-time-vs-runtime-secrets.md): When Docker builds on Railway can see your variables, how to pass build secrets with ARG, and why runtime secrets should never be baked into the image.
- [The Best Preview Environment Platforms in 2026](https://railway.com/guides/best-preview-environment-platforms-2026.md): Why preview environments are the most underrated PaaS feature in 2026, the collaboration flywheel they unlock, and which platforms make them one-click vs a project.
- [The Best CI/CD Tools for 2026](https://railway.com/guides/best-ci-cd-tools-2026.md): What CI/CD actually does in 2026, why most teams don't need a separate tool anymore, and an honest ranking of the platforms that handle it for you alongside the standalone tools for teams that still need them.
- [Serverless functions vs containers: CI/CD, database connections, cron jobs, and long-running tasks](https://railway.com/guides/serverless-functions-vs-containers-cicd-database-connections-cron-jobs-and-long-running-tasks.md): Comparing serverless and container deployments about auto-deploy workflows, secure database connections, scheduled jobs, rollbacks, and resource-intensive tasks. Each section explains both approaches honestly, with guidance on when serverless constraints matter and when containers make more sense.

## More guides

- [Manage Environment Variables in Frontend Builds](https://railway.com/guides/frontend-environment-variables.md): Understand build-time vs runtime environment variables in frontend frameworks. Covers Vite, Next.js, Nuxt, SvelteKit, Astro, and Angular prefix conventions and how Railway handles each.
- [Roll Back a Bad Deploy Fast](https://railway.com/guides/roll-back-bad-deploy.md): How to revert a broken deployment on Railway in under a minute. Covers rollback vs redeploy vs restart, image retention limits, and healthcheck-gated deploys that stop bad code before it goes live.
- [Isolate Staging from Production for Compliance](https://railway.com/guides/isolate-staging-production.md): Separate staging and production on Railway with per-environment networks, per-environment bucket instances, and environment-scoped credentials.
- [Sync Secrets from an External Secrets Manager](https://railway.com/guides/external-secrets-manager.md): Keep Doppler, Infisical, or Vault as your source of truth and push secrets into Railway variables with the Public API, a sync script, or a vendor integration.
- [Managing Secrets on Railway](https://railway.com/guides/managing-secrets-on-railway.md): How to store API keys, database URLs, and other secrets on Railway using service, shared, reference, and sealed variables, with no separate secrets manager.
- [Preview Deployments with PR Environments](https://railway.com/guides/preview-deployments-with-pr-environments.md): Learn how to use Railway PR Environments to spin up isolated, ephemeral preview deployments for every pull request, including Focused and Bot PR Environments.
- [GitHub Actions Self Hosted Runners](https://railway.com/guides/github-actions-runners.md): Learn how to deploy your own scalable self hosted GitHub Actions Runners on Railway. Build your own fleet of runners for your Enterprise and then scale your self-hosted runners with Railway replicas for blazing fast builds.
- [GitHub Actions PR Environment](https://railway.com/guides/github-actions-pr-environment.md): Learn how to use the CLI in a GitHub Action to create environments for PRs
- [GitHub Actions Post-Deploy](https://railway.com/guides/github-actions-post-deploy.md): Learn how to use GitHub Actions to run post-deployment commands.
- [CI/CD for Modern Deployment: From Manual Deploys to PR Environments](https://railway.com/guides/cicd-for-modern-deployment-from-manual-deploys-to-pr-environments.md): Deploy isolated preview environments for every pull request—services, databases, and config that match production, created and cleaned up automatically.
- [Implement a GitHub Actions Testing Suite](https://railway.com/guides/implementing-gh-actions-testing.md): Learn how to build a testing suite in GitHub actions and integrate it into your Railway deployment pipeline
- [Working with NX, Railway and CI/CD](https://railway.com/guides/nx-railway-with-gh-actions.md): A brief guide on managing CI/CD for your NX projects using GitHub Actions with Railway.
- [Using GitLab CI/CD with Railway](https://railway.com/guides/gitlab-ci-cd.md): GitLab CI/CD is a powerful continuous integration (CI) and continuous deployment (CD) system. In this post, we talk about how you can use GitLab CI/CD to automate your deployments on Railway.
- [Using Github Actions with Railway](https://railway.com/guides/github-actions.md): 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.

## Related topics

- [Security](https://railway.com/guides/topics/security.md): Manage secrets, add authentication, lock down projects and meet compliance requirements.
- [Comparisons and Migrations](https://railway.com/guides/topics/comparisons.md): How Railway compares with other platforms, what it costs, and how to move over from Heroku, AWS and others.
- [Containers and Hosting](https://railway.com/guides/topics/containers.md): Deploy from Docker and Compose, self-host open-source tools, and scale across replicas and regions.
- [Backend](https://railway.com/guides/topics/backend.md): APIs, background workers, queues, cron jobs and webhooks.
- [Frontend](https://railway.com/guides/topics/frontend.md): Ship Next.js, Astro, SvelteKit and SPAs, and run Node.js, Bun and full-stack TypeScript apps.
- [AI Agents](https://railway.com/guides/topics/ai.md): Host agents, MCP servers, RAG pipelines, model gateways and inference services.
