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
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install lftp
|
- name: Setup SSH
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
mkdir -p ~/.ssh
|
||||||
apt-get install -y lftp
|
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: |
|
run: |
|
||||||
echo "🚀 Deploying to Production..."
|
echo "🚀 Deploying to Production..."
|
||||||
lftp -c "
|
rsync -avz --delete \
|
||||||
set ftp:ssl-allow no
|
--exclude=".git/" \
|
||||||
set ftp:passive-mode yes
|
--exclude=".gitea/" \
|
||||||
open -u ${FTP_USER},${FTP_PASS} ${FTP_HOST}
|
--exclude=".gitignore" \
|
||||||
mirror -R --delete --verbose \
|
--exclude="designs/" \
|
||||||
--exclude-glob .git/ \
|
-e "ssh -p ${{ secrets.SSH_PORT }} -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no" \
|
||||||
--exclude-glob .gitea/ \
|
./ \
|
||||||
--exclude-glob .gitignore \
|
${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.TARGET_DIR }}
|
||||||
--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 }}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue