Skip to content

Commit 7ea6046

Browse files
committed
Fix site deploy: use lftp mirror instead of SFTP action
1 parent 07426f2 commit 7ea6046

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

.github/workflows/site.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ jobs:
2323
run: cd site && npm run build
2424

2525
- name: Deploy via SFTP
26-
uses: wlixcc/SFTP-Deploy-Action@v1.2.4
27-
with:
28-
server: ${{ secrets.SITE_HOST }}
29-
port: ${{ secrets.SITE_PORT || 22 }}
30-
username: ${{ secrets.SITE_USER }}
31-
ssh_private_key: ${{ secrets.SITE_SSH_KEY }}
32-
local_path: ./site/build/
33-
remote_path: ${{ secrets.SITE_PATH }}
34-
sftp_only: true
35-
delete_remote_files: true
26+
run: |
27+
sudo apt-get install -y -qq lftp > /dev/null 2>&1
28+
mkdir -p ~/.ssh
29+
echo "${{ secrets.SITE_SSH_KEY }}" > ~/.ssh/deploy_key
30+
chmod 600 ~/.ssh/deploy_key
31+
ssh-keyscan -p ${SITE_PORT:-22} ${{ secrets.SITE_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
32+
33+
lftp -c "
34+
set sftp:connect-program 'ssh -i $HOME/.ssh/deploy_key -p ${SITE_PORT:-22}';
35+
open sftp://${{ secrets.SITE_USER }}@${{ secrets.SITE_HOST }};
36+
mirror --reverse --delete --verbose site/build/ ${{ secrets.SITE_PATH }};
37+
"
38+
env:
39+
SITE_PORT: ${{ secrets.SITE_PORT }}

0 commit comments

Comments
 (0)