mirror of
https://github.com/henry4682/linebot_finance.git
synced 2026-05-16 04:41:52 +00:00
change gitea yaml
This commit is contained in:
@@ -6,20 +6,24 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
redeploy:
|
redeploy:
|
||||||
runs-on: self-hosted # 使用 self-hosted 標籤通常比較明確
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
# 進入專案資料夾
|
# 1. 確保 git 信任所有相關路徑,避免 dubious ownership 報錯
|
||||||
|
git config --global --add safe.directory /home/ubuntu/apps/linebot_finance
|
||||||
|
git config --global --add safe.directory /opt/1panel/apps/gitea/gitea/data/git/repositories/henry4682/linebot_finance.git
|
||||||
|
|
||||||
|
# 2. 進入部署目錄
|
||||||
cd /home/ubuntu/apps/linebot_finance || exit 1
|
cd /home/ubuntu/apps/linebot_finance || exit 1
|
||||||
|
|
||||||
# 解決目錄權限爭議
|
# 3. 從本地 Gitea 倉庫強制同步程式碼
|
||||||
git config --global --add safe.directory /home/ubuntu/apps/linebot_finance
|
echo "Syncing code from local filesystem..."
|
||||||
|
|
||||||
# 更新程式碼
|
|
||||||
git fetch --all
|
git fetch --all
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
# 重啟 Docker 容器
|
# 4. 重啟並重新編譯 Docker 容器
|
||||||
# 建議加上 --build 確保 Python/PHP 程式碼變動有被更新進 image
|
echo "Rebuilding and restarting Docker containers..."
|
||||||
docker compose up -d --build
|
docker compose up -d --build
|
||||||
|
|
||||||
|
echo "Deployment successful!"
|
||||||
Reference in New Issue
Block a user