Repository navigation
Merge pull request #69 from DIodide/feat/final-polish #49
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 Frontend | |
| on: | |
| push: | |
| branches: [staging, main] | |
| paths: | |
| - "apps/web/**" | |
| - "packages/convex-backend/**" | |
| - ".github/workflows/frontend-cd.yml" | |
| concurrency: | |
| group: frontend-deploy-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Deploy Convex backend | |
| run: cd packages/convex-backend && npx convex deploy | |
| env: | |
| CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }} | |
| - name: Determine environment | |
| id: env | |
| run: | | |
| if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
| echo "worker_name=harness-web" >> "$GITHUB_OUTPUT" | |
| echo "fastapi_url=${{ secrets.FASTAPI_URL_PROD }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "worker_name=harness-web-staging" >> "$GITHUB_OUTPUT" | |
| echo "fastapi_url=${{ secrets.FASTAPI_URL_STAGING }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build frontend | |
| run: cd apps/web && bun run build | |
| env: | |
| VITE_CONVEX_URL: ${{ secrets.VITE_CONVEX_URL }} | |
| VITE_CLERK_PUBLISHABLE_KEY: ${{ secrets.VITE_CLERK_PUBLISHABLE_KEY }} | |
| CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }} | |
| VITE_FASTAPI_URL: ${{ steps.env.outputs.fastapi_url }} | |
| ARCJET_KEY: ${{ secrets.ARCJET_KEY }} | |
| - name: Set Cloudflare Worker secrets | |
| run: | | |
| echo "${{ secrets.ARCJET_KEY }}" | cd apps/web && npx wrangler secret put ARCJET_KEY --name ${{ steps.env.outputs.worker_name }} | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| - name: Deploy to Cloudflare Workers | |
| run: cd apps/web && npx wrangler deploy --name ${{ steps.env.outputs.worker_name }} | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} |