From 83e3374cd60554521f45b7fdc99152b70fa069e9 Mon Sep 17 00:00:00 2001 From: henry yo Date: Sun, 15 Mar 2026 01:09:17 +0800 Subject: [PATCH] change gitea yaml --- .gitea/workflows/deploy.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index ac6b30f..6f592e9 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -3,13 +3,23 @@ on: push: branches: - main + jobs: redeploy: - runs-on: ubuntu-latest + runs-on: self-hosted # 使用 self-hosted 標籤通常比較明確 steps: - name: Deploy run: | + # 進入專案資料夾 + cd /home/ubuntu/apps/linebot_finance || exit 1 + + # 解決目錄權限爭議 git config --global --add safe.directory /home/ubuntu/apps/linebot_finance - cd /home/ubuntu/apps/linebot_finance - git pull - docker compose up -d \ No newline at end of file + + # 更新程式碼 + git fetch --all + git reset --hard origin/main + + # 重啟 Docker 容器 + # 建議加上 --build 確保 Python/PHP 程式碼變動有被更新進 image + docker compose up -d --build \ No newline at end of file