name: Deploy to Coolify on: push: branches: - main # Production deployment - develop # Development deployment pull_request: branches: - main - develop jobs: # Lint and type-check (runs on all pushes and PRs) quality-check: name: Code Quality runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Bun uses: oven-sh/setup-bun@v1 with: bun-version: latest - name: Install dependencies run: | if [ -d "app" ]; then cd app bun install --frozen-lockfile else echo "App directory not yet created, skipping" fi - name: Type check run: | if [ -d "app" ]; then cd app bun run typecheck || echo "Typecheck not configured yet" fi - name: Lint run: | if [ -d "app" ]; then cd app bun run lint || echo "Linting not configured yet" fi # Run tests (when implemented) test: name: Run Tests runs-on: ubuntu-latest needs: quality-check steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Bun uses: oven-sh/setup-bun@v1 with: bun-version: latest - name: Install dependencies run: | if [ -d "app" ]; then cd app bun install --frozen-lockfile fi - name: Run unit tests run: | if [ -d "app" ]; then cd app bun test || echo "Tests not configured yet" fi # Deploy to Development (develop branch only) deploy-dev: name: Deploy to Development runs-on: ubuntu-latest needs: [quality-check, test] if: github.ref == 'refs/heads/develop' && github.event_name == 'push' environment: name: development url: https://pantry-dev.jeanlucmakiola.de # Update with actual URL steps: - name: Trigger Coolify Deployment (Dev) run: | curl -X POST "${{ secrets.COOLIFY_WEBHOOK_DEV }}" \ -H "Content-Type: application/json" \ -d '{"branch": "develop"}' - name: Deployment Status run: | echo "✅ Deployment triggered for development environment" echo "🔗 Check status: https://coolify.jeanlucmakiola.de" # Deploy to Production (main branch only) deploy-prod: name: Deploy to Production runs-on: ubuntu-latest needs: [quality-check, test] if: github.ref == 'refs/heads/main' && github.event_name == 'push' environment: name: production url: https://pantry.jeanlucmakiola.de # Update with actual URL steps: - name: Trigger Coolify Deployment (Prod) run: | curl -X POST "${{ secrets.COOLIFY_WEBHOOK_PROD }}" \ -H "Content-Type: application/json" \ -d '{"branch": "main"}' - name: Deployment Status run: | echo "✅ Deployment triggered for production environment" echo "🔗 Check status: https://coolify.jeanlucmakiola.de" # Optional: Deploy to Test (manual trigger) deploy-test: name: Deploy to Test runs-on: ubuntu-latest needs: [quality-check, test] if: github.event_name == 'workflow_dispatch' environment: name: test steps: - name: Trigger Coolify Deployment (Test) run: | curl -X POST "${{ secrets.COOLIFY_WEBHOOK_TEST }}" \ -H "Content-Type: application/json" - name: Deployment Status run: | echo "✅ Deployment triggered for test environment"