star-cloud/.gitea/workflows/deploy-demo.yaml

44 lines
1.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: star-cloud-deploy-demo
on:
push:
branches:
- demo
jobs:
deploy-demo:
runs-on: ubuntu-latest # 使用機器人預設宣告的標籤
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Step 1 - Build & Deploy Containers
run: |
WWWGROUP=1000 WWWUSER=1000 docker compose -f compose.yaml up -d --build --wait
- name: Step 2 - Deploy Code
run: |
# Runner 容器模式下volume mount 無法正確對應宿主機路徑
# 使用 docker cp 直接將程式碼注入容器(透過 Docker socket
docker cp . star-cloud-laravel:/var/www/html/
- name: Step 3 - Composer & NPM & Initialization
run: |
docker exec -u 1000:1000 -w /var/www/html star-cloud-laravel sh -c "
composer install --no-dev --optimize-autoloader --no-interaction &&
npm install &&
npm run build &&
php artisan migrate --force &&
php artisan storage:link &&
php artisan optimize:clear &&
php artisan optimize &&
php artisan view:cache &&
php artisan queue:restart &&
php artisan db:seed --class=RoleSeeder --force &&
php artisan db:seed --class=AdminUserSeeder --force
"
docker exec star-cloud-laravel chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
- name: Step 4 - Cleanup
run: docker image prune -f