File tree Expand file tree Collapse file tree 1 file changed +71
-0
lines changed
Expand file tree Collapse file tree 1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Backend CI/CD
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - master
8+ paths :
9+ - " backend/**"
10+ - " .github/workflows/backend.yml"
11+ pull_request :
12+ branches :
13+ - main
14+ - master
15+ paths :
16+ - " backend/**"
17+ - " .github/workflows/backend.yml"
18+ workflow_dispatch :
19+
20+ permissions :
21+ contents : read
22+
23+ jobs :
24+ build-and-test :
25+ name : Build and Test Backend
26+ runs-on : ubuntu-latest
27+ defaults :
28+ run :
29+ working-directory : backend
30+
31+ steps :
32+ - name : Checkout
33+ uses : actions/checkout@v4
34+
35+ - name : Setup pnpm
36+ uses : pnpm/action-setup@v4
37+ with :
38+ version : 9
39+
40+ - name : Setup Node.js
41+ uses : actions/setup-node@v4
42+ with :
43+ node-version : " 20"
44+ cache : " pnpm"
45+ cache-dependency-path : backend/pnpm-lock.yaml
46+
47+ - name : Install dependencies
48+ run : pnpm install --frozen-lockfile
49+
50+ - name : Build
51+ run : pnpm run build
52+
53+ - name : Test
54+ run : pnpm run test -- --ci
55+
56+ deploy :
57+ name : Deploy Backend
58+ needs : build-and-test
59+ runs-on : ubuntu-latest
60+ if : github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
61+
62+ steps :
63+ - name : Deploy to Railway (deploy hook)
64+ if : ${{ secrets.RAILWAY_DEPLOY_HOOK_URL != '' }}
65+ env :
66+ RAILWAY_DEPLOY_HOOK_URL : ${{ secrets.RAILWAY_DEPLOY_HOOK_URL }}
67+ run : curl -fsSL -X POST "$RAILWAY_DEPLOY_HOOK_URL"
68+
69+ - name : Skip deploy when hook is missing
70+ if : ${{ secrets.RAILWAY_DEPLOY_HOOK_URL == '' }}
71+ run : echo "No RAILWAY_DEPLOY_HOOK_URL configured. Skipping deploy."
You can’t perform that action at this time.
0 commit comments