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:
@@ -10,20 +10,23 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
# 1. 確保 git 信任所有相關路徑,避免 dubious ownership 報錯
|
# 1. 徹底忽略所有權限與擁有者檢查 (對全域生效)
|
||||||
git config --global --add safe.directory /home/ubuntu/apps/linebot_finance
|
git config --global --add safe.directory "*"
|
||||||
git config --global --add safe.directory /opt/1panel/apps/gitea/gitea/data/git/repositories/henry4682/linebot_finance.git
|
|
||||||
|
|
||||||
# 2. 進入部署目錄
|
# 2. 進入部署目錄
|
||||||
cd /home/ubuntu/apps/linebot_finance || exit 1
|
cd /home/ubuntu/apps/linebot_finance || exit 1
|
||||||
|
|
||||||
# 3. 從本地 Gitea 倉庫強制同步程式碼
|
# 3. 再次設定一次遠端,確保 Runner 抓到的是本地絕對路徑
|
||||||
echo "Syncing code from local filesystem..."
|
# 加上 file:// 前綴,強制讓 Git 走檔案系統協議
|
||||||
|
git remote set-url origin "file:///opt/1panel/apps/gitea/gitea/data/git/repositories/henry4682/linebot_finance.git"
|
||||||
|
|
||||||
|
# 4. 強制同步
|
||||||
|
echo "Syncing code via Local Filesystem Protocol..."
|
||||||
git fetch --all
|
git fetch --all
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
# 4. 重啟並重新編譯 Docker 容器
|
# 5. 重啟 Docker
|
||||||
echo "Rebuilding and restarting Docker containers..."
|
echo "Rebuilding and restarting Docker..."
|
||||||
docker compose up -d --build
|
docker compose up -d --build
|
||||||
|
|
||||||
echo "Deployment successful!"
|
echo "Deployment successful!"
|
||||||
Reference in New Issue
Block a user