Client task source of truth & xml metadata helper (#419) #405
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 Client | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main, dev] | |
| paths: | |
| - "client/**" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "client/**" | |
| jobs: | |
| deploy: | |
| name: Deploy to Vercel | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| cache-dependency-path: client/pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Fetch font | |
| run: | | |
| mkdir -p app/src/assets/fonts | |
| curl -f -H "Authorization: Bearer ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}" \ | |
| "${{ secrets.SUPABASE_URL }}/storage/v1/object/GB%20Assets/tx-02.woff2" \ | |
| -o app/src/assets/fonts/tx-02.woff2 | |
| - name: Install Vercel CLI | |
| run: pnpm add -g vercel | |
| - name: Pull Vercel environment | |
| run: | | |
| if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| else | |
| vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | |
| fi | |
| - name: Force dev API for preview builds | |
| if: github.event_name != 'push' || github.ref != 'refs/heads/main' | |
| run: | | |
| echo "SUPABASE_PROJECT_REF=${{ secrets.SUPABASE_PROJECT_REF }}" >> "$GITHUB_ENV" | |
| echo "VITE_SERVER_URL=https://${{ secrets.SUPABASE_PROJECT_REF }}.supabase.co/functions/v1" >> "$GITHUB_ENV" | |
| echo "VITE_PIPECAT_TRANSPORT=daily" >> "$GITHUB_ENV" | |
| - name: Build | |
| run: | | |
| if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| else | |
| vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
| fi | |
| - name: Verify preview API target | |
| if: github.event_name != 'push' || github.ref != 'refs/heads/main' | |
| run: | | |
| if grep -R "api.gradient-bang.com/functions/v1" .vercel/output app/dist 2>/dev/null; then | |
| echo "Preview build contains production API URL" | |
| exit 1 | |
| fi | |
| if ! grep -R "https://${SUPABASE_PROJECT_REF}.supabase.co/functions/v1" .vercel/output app/dist >/dev/null 2>&1; then | |
| echo "Preview build does not contain expected dev API URL" | |
| exit 1 | |
| fi | |
| - name: Deploy | |
| id: deploy | |
| run: | | |
| if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| else | |
| echo "url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Comment preview URL on PR | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `Preview deployed: ${{ steps.deploy.outputs.url }}` | |
| }) | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} |