Files
linebot_finance/.gitea/workflows/deploy.yaml
2026-03-15 02:06:48 +08:00

34 lines
1.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Oracle-Deploy
on:
push:
branches:
- main
jobs:
redeploy:
runs-on: self-hosted
# 不使用 steps 的 uses全部改用 run
steps:
- name: Deploy
run: |
# 1. 由於 Runner 容器裡沒有 sudo我們假設它有權限訪問掛載的路徑
# 我們直接嘗試在「主機」路徑執行指令
echo "Starting Direct Host Deployment..."
# 2. 這是最關鍵的一步:
# 如果你的 Runner 是 1Panel 裝的,它通常會把主機的目錄掛載進來
# 我們直接對準主機上的 linebot_finance 資料夾操作
# 3. 執行同步與部署
# 我們假設路徑已經在之前的步驟設定好 safe.directory 了
cd /home/ubuntu/apps/linebot_finance || exit 1
# 使用絕對路徑執行 git避免 PATH 問題
/usr/bin/git fetch --all
/usr/bin/git reset --hard origin/main
# 4. 重啟 Docker
/usr/bin/docker compose up -d --build
echo "Deployment finished!"