All checks were successful
Build Frontend / Build Frontend (push) Successful in 20s
69 lines
1.9 KiB
YAML
69 lines
1.9 KiB
YAML
name: Build Frontend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Frontend
|
|
runs-on: Turbo-Dev
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "24"
|
|
|
|
- name: Install Backend Dependencies
|
|
run: npm install --production
|
|
|
|
- name: Install Frontend Dependencies
|
|
run: |
|
|
cd frontend
|
|
npm install
|
|
|
|
- name: Build Frontend
|
|
run: |
|
|
cd frontend
|
|
npm run build
|
|
env:
|
|
NODE_ENV: production
|
|
VITE_API_URL: https://api.turbotrades.dev
|
|
VITE_WS_URL: https://ws.turbotrades.dev
|
|
|
|
- name: Deploy to Server
|
|
run: |
|
|
# SSH Key Configuration (update path to your key)
|
|
SERVER_HOST="turbotrades.dev"
|
|
SERVER_USER="root"
|
|
SSH_KEY="$HOME/.ssh/gitea_deploy"
|
|
SERVER_PORT="22"
|
|
|
|
echo "🚀 Deploying to server..."
|
|
|
|
# Sync backend files
|
|
echo "📦 Syncing backend..."
|
|
rsync -avz --delete \
|
|
--exclude 'node_modules' \
|
|
--exclude '.git' \
|
|
--exclude 'frontend/node_modules' \
|
|
--exclude 'frontend/dist' \
|
|
-e "ssh -i $SSH_KEY -o StrictHostKeyChecking=no -p $SERVER_PORT" \
|
|
./ ${SERVER_USER}@${SERVER_HOST}:/root/ttbackend/
|
|
|
|
# Sync frontend build
|
|
echo "🎨 Syncing frontend..."
|
|
rsync -avz --delete \
|
|
-e "ssh -i $SSH_KEY -o StrictHostKeyChecking=no -p $SERVER_PORT" \
|
|
./frontend/dist/ ${SERVER_USER}@${SERVER_HOST}:/var/www/html/turbotrades/
|
|
|
|
echo "✅ Deployment complete!"
|
|
echo "🌐 Frontend: https://turbotrades.dev"
|
|
echo "🔧 Backend: https://api.turbotrades.dev"
|
|
echo "💬 PM2 will auto-reload with --watch"
|