🔥 Add Firebase integration - Complete setup with services, routes, an… #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Web (Client Portal) | |
| on: | |
| push: | |
| branches: [main, master] | |
| paths: | |
| - 'apps/client-portal/**' | |
| - 'apps/client-portal/**/*' | |
| pull_request: | |
| branches: [main, master] | |
| paths: | |
| - 'apps/client-portal/**' | |
| workflow_dispatch: | |
| jobs: | |
| deploy-web: | |
| name: Deploy to Cloudflare Pages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Check if client-portal exists | |
| id: check_portal | |
| run: | | |
| if [ -d "apps/client-portal" ]; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "path=apps/client-portal" >> $GITHUB_OUTPUT | |
| elif [ -d "client-portal" ]; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "path=client-portal" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "path=" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Install dependencies | |
| if: steps.check_portal.outputs.exists == 'true' | |
| working-directory: ./${{ steps.check_portal.outputs.path }} | |
| run: | | |
| if [ -f "package.json" ]; then | |
| npm ci || npm install || echo "Dependencies installation skipped" | |
| else | |
| echo "No package.json found - static site, no dependencies needed" | |
| fi | |
| - name: Build (if needed) | |
| if: steps.check_portal.outputs.exists == 'true' | |
| working-directory: ./${{ steps.check_portal.outputs.path }} | |
| run: | | |
| if [ -f "package.json" ] && grep -q '"build"' package.json; then | |
| npm run build | |
| else | |
| echo "No build step required - deploying static files" | |
| fi | |
| - name: Deploy to Cloudflare Pages | |
| if: steps.check_portal.outputs.exists == 'true' | |
| uses: cloudflare/pages-action@v1 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| projectName: ${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME || 'rare4n-client-portal' }} | |
| directory: ./${{ steps.check_portal.outputs.path }} | |
| gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Skip deployment - client-portal not found | |
| if: steps.check_portal.outputs.exists == 'false' | |
| run: | | |
| echo "⚠️ Client Portal directory not found. Skipping deployment." | |
| exit 0 | |
| - name: Notify deployment completion | |
| if: always() | |
| run: | | |
| curl -X POST "${{ secrets.API_URL }}/api/auto-builder/deploy-complete" \ | |
| -H "Content-Type: application/json" \ | |
| -H "Authorization: Bearer ${{ secrets.API_TOKEN }}" \ | |
| -d '{ | |
| "platform": "web", | |
| "status": "${{ job.status }}", | |
| "workflow": "${{ github.workflow }}", | |
| "run_id": "${{ github.run_id }}", | |
| "commit": "${{ github.sha }}" | |
| }' || true | |