mirror of
https://github.com/henry4682/linebot_finance.git
synced 2026-05-16 04:41:52 +00:00
32 lines
1.0 KiB
YAML
32 lines
1.0 KiB
YAML
name: Oracle-Deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
redeploy:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Deploy
|
|
run: |
|
|
# 1. 徹底忽略所有權限與擁有者檢查 (對全域生效)
|
|
git config --global --add safe.directory "*"
|
|
|
|
# 2. 進入部署目錄
|
|
cd /home/ubuntu/apps/linebot_finance || exit 1
|
|
|
|
# 3. 再次設定一次遠端,確保 Runner 抓到的是本地絕對路徑
|
|
# 加上 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 reset --hard origin/main
|
|
|
|
# 5. 重啟 Docker
|
|
echo "Rebuilding and restarting Docker..."
|
|
docker compose up -d --build
|
|
|
|
echo "Deployment successful!" |