Switch to SSH key authentication
All checks were successful
Build Frontend / Build Frontend (push) Successful in 20s
All checks were successful
Build Frontend / Build Frontend (push) Successful in 20s
This commit is contained in:
@@ -38,31 +38,28 @@ jobs:
|
|||||||
|
|
||||||
- name: Deploy to Server
|
- name: Deploy to Server
|
||||||
run: |
|
run: |
|
||||||
# Hardcoded credentials (replace these values)
|
# SSH Key Configuration (update path to your key)
|
||||||
SERVER_HOST="your.server.host"
|
SERVER_HOST="turbotrades.dev"
|
||||||
SERVER_USER="root"
|
SERVER_USER="root"
|
||||||
SERVER_PASSWORD="your_password"
|
SSH_KEY="$HOME/.ssh/gitea_deploy"
|
||||||
SERVER_PORT="22"
|
SERVER_PORT="22"
|
||||||
|
|
||||||
echo "🚀 Deploying to server..."
|
echo "🚀 Deploying to server..."
|
||||||
|
|
||||||
# Install sshpass
|
|
||||||
sudo apt-get update && sudo apt-get install -y sshpass rsync
|
|
||||||
|
|
||||||
# Sync backend files
|
# Sync backend files
|
||||||
echo "📦 Syncing backend..."
|
echo "📦 Syncing backend..."
|
||||||
sshpass -p "$SERVER_PASSWORD" rsync -avz --delete \
|
rsync -avz --delete \
|
||||||
--exclude 'node_modules' \
|
--exclude 'node_modules' \
|
||||||
--exclude '.git' \
|
--exclude '.git' \
|
||||||
--exclude 'frontend/node_modules' \
|
--exclude 'frontend/node_modules' \
|
||||||
--exclude 'frontend/dist' \
|
--exclude 'frontend/dist' \
|
||||||
-e "ssh -o StrictHostKeyChecking=no -p $SERVER_PORT" \
|
-e "ssh -i $SSH_KEY -o StrictHostKeyChecking=no -p $SERVER_PORT" \
|
||||||
./ ${SERVER_USER}@${SERVER_HOST}:/root/ttbackend/
|
./ ${SERVER_USER}@${SERVER_HOST}:/root/ttbackend/
|
||||||
|
|
||||||
# Sync frontend build
|
# Sync frontend build
|
||||||
echo "🎨 Syncing frontend..."
|
echo "🎨 Syncing frontend..."
|
||||||
sshpass -p "$SERVER_PASSWORD" rsync -avz --delete \
|
rsync -avz --delete \
|
||||||
-e "ssh -o StrictHostKeyChecking=no -p $SERVER_PORT" \
|
-e "ssh -i $SSH_KEY -o StrictHostKeyChecking=no -p $SERVER_PORT" \
|
||||||
./frontend/dist/ ${SERVER_USER}@${SERVER_HOST}:/var/www/html/turbotrades/
|
./frontend/dist/ ${SERVER_USER}@${SERVER_HOST}:/var/www/html/turbotrades/
|
||||||
|
|
||||||
echo "✅ Deployment complete!"
|
echo "✅ Deployment complete!"
|
||||||
|
|||||||
Reference in New Issue
Block a user