This repository was archived by the owner on Jul 20, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,22 +17,13 @@ jobs:
1717 echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
1818 chmod 600 ~/.ssh/deploy_key
1919
20- - name : Create SFTP batch commands
20+ - name : Deploy with rsync
2121 run : |
22- # Generate list of files to upload
23- cat > sftp_commands.txt << 'EOF'
24- cd html
25- EOF
26-
27- # Add commands to upload each file
28- find . -type f -not -path "./.git/*" -not -path "./.github/*" -not -path "./node_modules/*" -not -name ".env" | while read file; do
29- echo "put \"$file\" \"${file#./}\"" >> sftp_commands.txt
30- done
31-
32- - name : Deploy via SFTP
33- run : |
34- sftp -b sftp_commands.txt \
35- -P ${{ secrets.SERVER_PORT }} \
36- -i ~/.ssh/deploy_key \
37- -o StrictHostKeyChecking=accept-new \
38- ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }}
22+ rsync -avz --delete \
23+ -e "ssh -p ${{ secrets.SERVER_PORT }} -i ~/.ssh/deploy_key -o StrictHostKeyChecking=accept-new" \
24+ --exclude '.git' \
25+ --exclude '.github' \
26+ --exclude 'node_modules' \
27+ --exclude '.env' \
28+ --exclude '.gitignore' \
29+ ./ ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }}:/var/www/html/
You can’t perform that action at this time.
0 commit comments