Skip to content

Commit 31f3307

Browse files
committed
feat: add GitHub Actions workflow for manual production deploys
1 parent df3507f commit 31f3307

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy Production
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: Git ref to deploy
8+
required: true
9+
default: main
10+
type: string
11+
12+
concurrency:
13+
group: deploy-production-site
14+
cancel-in-progress: false
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
deploy:
21+
runs-on: ubuntu-latest
22+
environment: production-site
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ inputs.ref }}
28+
29+
- name: Setup Node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 24.14.0
33+
34+
- name: Install Railway CLI
35+
run: npm install --global @railway/cli
36+
37+
- name: Validate deploy config
38+
shell: bash
39+
env:
40+
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
41+
RAILWAY_PROJECT: ${{ vars.RAILWAY_PROD_PROJECT_ID }}
42+
RAILWAY_ENVIRONMENT: ${{ vars.RAILWAY_PROD_ENVIRONMENT }}
43+
RAILWAY_SERVICE: ${{ vars.RAILWAY_PROD_SERVICE }}
44+
run: |
45+
test -n "$RAILWAY_TOKEN" || { echo "Missing GitHub secret: RAILWAY_TOKEN"; exit 1; }
46+
test -n "$RAILWAY_PROJECT" || { echo "Missing GitHub variable: RAILWAY_PROD_PROJECT_ID"; exit 1; }
47+
test -n "$RAILWAY_ENVIRONMENT" || { echo "Missing GitHub variable: RAILWAY_PROD_ENVIRONMENT"; exit 1; }
48+
test -n "$RAILWAY_SERVICE" || { echo "Missing GitHub variable: RAILWAY_PROD_SERVICE"; exit 1; }
49+
50+
- name: Deploy site to Railway
51+
env:
52+
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
53+
RAILWAY_PROJECT: ${{ vars.RAILWAY_PROD_PROJECT_ID }}
54+
RAILWAY_ENVIRONMENT: ${{ vars.RAILWAY_PROD_ENVIRONMENT }}
55+
RAILWAY_SERVICE: ${{ vars.RAILWAY_PROD_SERVICE }}
56+
run: railway up --ci --service "$RAILWAY_SERVICE" --environment "$RAILWAY_ENVIRONMENT" --project "$RAILWAY_PROJECT"

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ That file forces Railway to treat the site as a Nitro-backed app instead of a st
5252
3. Set `VITE_STACKFOX_DASHBOARD_URL` to the public dashboard URL.
5353
4. Deploy and bind the production domain after the healthcheck passes.
5454

55+
### Manual production deploys from GitHub Actions
56+
57+
If you want to stop Railway from deploying every commit, use `.github/workflows/deploy-production.yml` as the production deploy entrypoint for this repo.
58+
59+
Required GitHub repository secret:
60+
61+
- `RAILWAY_TOKEN`: a Railway project token scoped to the production environment for the `stackfox.dev` Railway project
62+
63+
Required GitHub repository variables:
64+
65+
- `RAILWAY_PROD_PROJECT_ID`: the Railway project ID for `stackfox.dev`
66+
- `RAILWAY_PROD_ENVIRONMENT`: the Railway environment name, usually `production`
67+
- `RAILWAY_PROD_SERVICE`: the Railway service ID or exact service name for the site
68+
69+
Recommended GitHub environment:
70+
71+
- `production-site`
72+
5573
## Contributing
5674

5775
Contributions to the StackFox site are welcome! If you have suggestions for improvements, please open an issue or submit a pull request.

0 commit comments

Comments
 (0)