File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ name: Deploy Vite React App
33on :
44 push :
55 branches :
6- - main # Change to your default branch
6+ - main
77
88jobs :
99 deploy :
@@ -34,26 +34,16 @@ jobs:
3434 BACKUP_DIR="${DEPLOY_DIR}.backup.$(date +%Y%m%d_%H%M%S)"
3535 echo "Creating backup at $BACKUP_DIR"
3636 sudo cp -r "$DEPLOY_DIR" "$BACKUP_DIR"
37-
38- # Keep only last 5 backups
3937 ls -dt ${DEPLOY_DIR}.backup.* | tail -n +6 | xargs -r sudo rm -rf
4038 fi
4139
4240 - name : Deploy to server
4341 run : |
4442 DEPLOY_DIR="/var/www/your-app"
4543 echo "Deploying to $DEPLOY_DIR"
46-
47- # Create directory if it doesn't exist
4844 sudo mkdir -p "$DEPLOY_DIR"
49-
50- # Remove old files
5145 sudo rm -rf "$DEPLOY_DIR"/*
52-
53- # Copy new build
5446 sudo cp -r ./dist/* "$DEPLOY_DIR"/
55-
56- # Set proper permissions
5747 sudo chown -R www-data:www-data "$DEPLOY_DIR"
5848 sudo chmod -R 755 "$DEPLOY_DIR"
5949
You can’t perform that action at this time.
0 commit comments