123
Some checks failed
Koori-ERP-Deploy-System / deploy-demo (push) Has been skipped
Koori-ERP-Deploy-System / deploy-production (push) Has been cancelled

This commit is contained in:
2026-01-06 10:47:28 +08:00
parent d683861233
commit 0aaa761a47

View File

@@ -44,15 +44,22 @@ jobs:
# 使用 rsync 透過 2224 Port 推送代碼
- name: Push Code to Production
run: |
# 1. 快速安裝工具
apt-get update && apt-get install -y rsync openssh-client
# 注意:這裡的 -e 指定了 ssh port 2224
# 2. 準備鑰匙
mkdir -p ~/.ssh
echo "${{ secrets.PROD_SSH_KEY }}" > ~/.ssh/id_rsa_prod
chmod 600 ~/.ssh/id_rsa_prod
# 3. 精簡後的同步指令 (只排除 .git)
rsync -avz --delete \
--exclude='.git' \
--exclude='node_modules' \
--exclude='vendor' \
-e "ssh -p 2224 -o StrictHostKeyChecking=no" \
-e "ssh -p 2224 -i ~/.ssh/id_rsa_prod -o StrictHostKeyChecking=no" \
./ root@erp.koori.tw:/var/www/koori-erp-prod/
rm ~/.ssh/id_rsa_prod
# 遠端執行 Docker 指令
- name: Remote Docker Commands
uses: appleboy/ssh-action@master