123
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user