File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed
Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Production Deployment
2+
3+ on :
4+ push :
5+ branches : [ "main" ] # Branch adın 'master' ise burayı değiştir
6+
7+ jobs :
8+ deploy :
9+ runs-on : self-hosted # Sunucundaki runner'ı tetikler
10+
11+ steps :
12+ - name : Checkout Code
13+ uses : actions/checkout@v4
14+
15+ - name : Setup Node.js
16+ uses : actions/setup-node@v4
17+ with :
18+ node-version : ' 22'
19+ cache : ' npm'
20+
21+ # 1. TÜM BAĞIMLILIKLARI KUR (ROOT)
22+ # package-lock.json root'ta olduğu için kurulumu en dışta yapıyoruz.
23+ - name : Install Dependencies
24+ run : npm ci
25+
26+ # 2. LINT KONTROLLERİ (Hata varsa durur)
27+ # - name: Lint Backend
28+ # working-directory: ./backend
29+ # run: npm run lint
30+ # continue-on-error: false # Hata varsa durdur
31+
32+ # ## - name: Lint Frontend
33+ # working-directory: ./frontend
34+ # run: npm run lint
35+ # continue-on-error: false
36+
37+ # 3. BUILD İŞLEMLERİ
38+ - name : Build Backend
39+ working-directory : ./backend
40+ run : npm run build
41+
42+ - name : Build Frontend
43+ working-directory : ./frontend
44+ run : npm run build
45+
46+ # 4. DEPLOY (Dosyaları Taşıma)
47+ # Runner _work klasöründe çalışır, biten işi canlı klasörüne taşırız.
48+ - name : Deploy to Production Folder
49+ run : |
50+ echo "Dosyalar taşınıyor..."
51+ # node_modules root'ta olduğu için onu ve app klasörlerini taşıyoruz
52+ rsync -av --exclude '.git' --exclude '.github' --exclude '.env' ./ /root/apps/validatier/
53+
54+ # 5. PM2 RELOAD
55+ - name : Restart PM2
56+ run : |
57+ cd /root/apps/validatier
58+ # Yeni environment değişkenlerini de alması için update-env
59+ pm2 reload ecosystem.config.js --update-env
60+ pm2 save
You can’t perform that action at this time.
0 commit comments