Update .gitea/workflows/ftp_deploy.yml/ftp_deploy.yml
This commit is contained in:
parent
e0ee64e7f1
commit
53f249df70
|
|
@ -1,32 +1,34 @@
|
|||
name: Specific Folder FTP Upload
|
||||
name: Local to Remote RSYNC Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main # Change this if your default branch is master
|
||||
- main
|
||||
paths:
|
||||
- 'resources/views/form/**' # 👈 CHANGE THIS to your folder name
|
||||
- 'resources/views/form/**'
|
||||
|
||||
jobs:
|
||||
ftp-deploy:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# 1. Checkout the code
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2 # Fetches the current and previous commit to calculate differences
|
||||
|
||||
# 2. Extract and Upload only the changed files
|
||||
- name: Sync Changed Files via SFTP
|
||||
uses: easingthemes/ssh-deploy@v5.1.0
|
||||
with:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
REMOTE_HOST: '157.245.101.206'
|
||||
REMOTE_USER: 'root'
|
||||
# 👇 Fixed: Points rsync to the exact source within the checkout space
|
||||
# 👇 Fixed: Using a relative dot-notation path to align with the plugin's internal root mapping
|
||||
SOURCE: './resources/views/form/'
|
||||
TARGET: '/var/www/rapport/resources/views/form/'
|
||||
# 👇 Added explicitly to prevent scanning node_modules/vendor completely
|
||||
ARGS: '-rlgoDIVzcv'
|
||||
- name: Fetch Locally and RSYNC to Remote VPS
|
||||
run: |
|
||||
echo "📂 1. Navigating to local directory..."
|
||||
cd /var/www/rapport
|
||||
|
||||
echo "🔄 2. Fetching latest changes from Gitea down to local..."
|
||||
git fetch origin main
|
||||
git reset --hard origin/main
|
||||
|
||||
echo "🔒 3. Securing SSH Key permissions for the sync..."
|
||||
# Enforces strict owner-only permissions so SSH doesn't reject the key
|
||||
chmod 600 /home/swtserver/ravimac
|
||||
|
||||
echo "🚚 4. Pushing changes from local folder to the remote server..."
|
||||
# Uses lowercase verbose flags and parent-folder directory target mapping
|
||||
rsync -rlgodivzc \
|
||||
-e "ssh -p 22 -i /home/swtserver/ravimac -o StrictHostKeyChecking=no" \
|
||||
resources/views/form \
|
||||
root@157.245.101.206:/var/www/rapport/resources/views/
|
||||
|
||||
echo "✨ Remote deployment successful!"
|
||||
Loading…
Reference in New Issue