Files
finance_app/.gitea/workflows/deploy.yaml
henry yo 3c9450e24b
Some checks failed
Laravel-Oracle-Deploy / redeploy (push) Has been cancelled
fix: change dir name
2026-06-25 15:46:57 +08:00

31 lines
1.0 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: Laravel-Oracle-Deploy
on:
push:
branches:
- main
jobs:
redeploy:
runs-on: self-hosted
steps:
- name: Sync and Deploy Laravel Backend
run: |
# 🎯 1. 換成你 Oracle 主機上 Laravel 專案的實際路徑
cd /home/ubuntu/apps/finance-backend || exit 1
# 2. 強制拉取 Gitea 上的最新代碼
git fetch origin main
git reset --hard origin/main
# 3. 重啟 Docker 容器並自動編譯
docker compose up -d --build --remove-orphans
# 4. (選用) 讓 Laravel 容器內部執行資料庫遷移與清除快取
# 假設你的 Laravel 容器服務名稱叫 app如果有需要可以解開下面幾行
# docker compose exec -T app php artisan migrate --force
# docker compose exec -T app php artisan config:cache
# docker compose exec -T app php artisan route:cache
# 5. 清理舊的 Docker 鏡像
docker image prune -f