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

33 lines
992 B
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:
# 1. 讓 Runner 把最新程式碼下載到它自己的容器裡
- name: Checkout Code
uses: actions/checkout@v3
# 2. 將下載好的程式碼搬移到主機上的運行目錄
- name: Sync Files to App Directory
run: |
echo "Current directory contains:"
ls -la
# 直接將當前目錄的所有檔案複製到目標目錄
# -a 保留屬性, -f 強制覆蓋
# 注意:我們不走 git fetch直接覆蓋檔案
cp -rf . /home/ubuntu/apps/linebot_finance/
echo "Sync completed. Switching to App directory..."
cd /home/ubuntu/apps/linebot_finance
# 3. 執行 Docker Compose
echo "Rebuilding and restarting Docker..."
docker compose up -d --build
echo "Deployment successful!"