Update workflow to use SSH deployment with rsync instead of FTP
This commit is contained in:
parent
e921813894
commit
468217a3f7
|
|
@ -13,27 +13,20 @@ jobs:
|
|||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install lftp
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y lftp
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
- name: Deploy to Production Server (FTP)
|
||||
- name: Deploy to Production Server
|
||||
run: |
|
||||
echo "🚀 Deploying to Production..."
|
||||
lftp -c "
|
||||
set ftp:ssl-allow no
|
||||
set ftp:passive-mode yes
|
||||
open -u ${FTP_USER},${FTP_PASS} ${FTP_HOST}
|
||||
mirror -R --delete --verbose \
|
||||
--exclude-glob .git/ \
|
||||
--exclude-glob .gitea/ \
|
||||
--exclude-glob .gitignore \
|
||||
--exclude-glob designs/ \
|
||||
./ ${TARGET_DIR}
|
||||
"
|
||||
env:
|
||||
FTP_HOST: ${{ secrets.FTP_HOST }}
|
||||
FTP_USER: ${{ secrets.FTP_USER }}
|
||||
FTP_PASS: ${{ secrets.FTP_PASS }}
|
||||
TARGET_DIR: ${{ secrets.TARGET_DIR }}
|
||||
rsync -avz --delete \
|
||||
--exclude=".git/" \
|
||||
--exclude=".gitea/" \
|
||||
--exclude=".gitignore" \
|
||||
--exclude="designs/" \
|
||||
-e "ssh -p ${{ secrets.SSH_PORT }} -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no" \
|
||||
./ \
|
||||
${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.TARGET_DIR }}
|
||||
|
|
|
|||
Loading…
Reference in New Issue