mirror of
https://github.com/henry4682/linebot_finance.git
synced 2026-05-16 04:41:52 +00:00
29 lines
959 B
YAML
29 lines
959 B
YAML
name: Oracle-Deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
redeploy:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Deploy
|
|
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
|
|
|
|
# 3. 從本地 Gitea 倉庫強制同步程式碼
|
|
echo "Syncing code from local filesystem..."
|
|
git fetch --all
|
|
git reset --hard origin/main
|
|
|
|
# 4. 重啟並重新編譯 Docker 容器
|
|
echo "Rebuilding and restarting Docker containers..."
|
|
docker compose up -d --build
|
|
|
|
echo "Deployment successful!" |