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,22 +10,24 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
# 1. 徹底忽略所有權限與擁有者檢查 (對全域生效)
|
# 1. 強制讓 Git 信任所有路徑
|
||||||
git config --global --add safe.directory "*"
|
git config --global --add safe.directory "*"
|
||||||
|
|
||||||
# 2. 進入部署目錄
|
# 2. 進入部署目錄
|
||||||
cd /home/ubuntu/apps/linebot_finance || exit 1
|
cd /home/ubuntu/apps/linebot_finance || exit 1
|
||||||
|
|
||||||
# 3. 再次設定一次遠端,確保 Runner 抓到的是本地絕對路徑
|
# 3. 確保遠端路徑正確
|
||||||
# 加上 file:// 前綴,強制讓 Git 走檔案系統協議
|
git remote set-url origin "/opt/1panel/apps/gitea/gitea/data/git/repositories/henry4682/linebot_finance.git"
|
||||||
git remote set-url origin "file:///opt/1panel/apps/gitea/gitea/data/git/repositories/henry4682/linebot_finance.git"
|
|
||||||
|
|
||||||
# 4. 強制同步
|
# 4. 強制同步 (關鍵:使用 sudo 權限執行,確保能讀取 1Panel 資料夾)
|
||||||
echo "Syncing code via Local Filesystem Protocol..."
|
echo "Syncing code using sudo to overcome directory permissions..."
|
||||||
git fetch --all
|
sudo git fetch --all
|
||||||
git reset --hard origin/main
|
sudo git reset --hard origin/main
|
||||||
|
|
||||||
# 5. 重啟 Docker
|
# 5. 確保檔案擁有者回到 ubuntu
|
||||||
|
sudo chown -R ubuntu:ubuntu /home/ubuntu/apps/linebot_finance
|
||||||
|
|
||||||
|
# 6. 重啟 Docker
|
||||||
echo "Rebuilding and restarting Docker..."
|
echo "Rebuilding and restarting Docker..."
|
||||||
docker compose up -d --build
|
docker compose up -d --build
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user