Files
star-erp/.gitea/workflows/deploy.yaml
Workflow config file is invalid. Please check your config file: EOF
2025-12-31 13:43:22 +08:00

61 lines
2.5 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: Koori-ERP-Deploy
# on:
# push:
# branches:
# - main
# jobs:
# auto-deploy:
# runs-on: ubuntu-latest
# steps:
# - name: 1. Checkout Code
# uses: actions/checkout@v3
# with:
# # --- 關鍵:直接指定 Gitea 的伺服器網址為 IP ---
# github-server-url: http://192.168.0.103:3000
# repository: ${{ gitea.repository }}
# # ------------------------------------------
# - name: 2. Create .env from Secrets
# run: echo "${{ secrets.DOT2_ENV }}" > .env
# - name: 3. Build and Start Docker
# run: |
# docker compose down --remove-orphans
# docker compose up -d --build --force-recreate
# # 【強制注入】不管是掛載失效還是路徑對不上,這招一定能把 web.php 送進去
# tar -cf - . | docker exec -i koori-erp-laravel.test-1 tar -xf - -C /var/www/html
# # 修正權限這步沒做Laravel 後面也會噴錯)
# docker exec koori-erp-laravel.test-1 chown -R www-data:www-data /var/www/html
# - name: 4. Initialize Laravel
# run: |
# # 先進容器確認 composer.json 是否真的在那裡
# docker exec koori-erp-laravel.test-1 ls -F /var/www/html/
# # 執行安裝
# docker exec -w /var/www/html koori-erp-laravel.test-1 composer install --optimize-autoloader --no-dev
# # 其他初始化指令
# docker exec koori-erp-laravel.test-1 php artisan key:generate --force
# docker exec koori-erp-laravel.test-1 php artisan storage:link
# docker exec koori-erp-laravel.test-1 php artisan migrate --force
# - name: 5. Fix Permissions (Sail Mode)
# run: |
# # 同時照顧 www-data 和 sail
# docker exec koori-erp-laravel.test-1 chmod -R 777 /var/www/html/storage
# docker exec koori-erp-laravel.test-1 php artisan view:clear
# - name: 6. Build Frontend Assets (Vite)
# run: |
# # 1. 進入容器安裝 NPM 套件
# docker exec -w /var/www/html koori-erp-laravel.test-1 npm install
# # 2. 執行 Vite 編譯 (這會產生 manifest.json)
# docker exec -w /var/www/html koori-erp-laravel.test-1 npm run build
# # 3. 再次確保編譯出來的 public/build 權限也是正確的
# docker exec koori-erp-laravel.test-1 chown -R www-data:www-data /var/www/html/public