fix(cors): add CORS headers to better-auth responses #58
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 Stack | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| api: ${{ steps.filter.outputs.api }} | |
| web: ${{ steps.filter.outputs.web }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| api: | |
| - 'api/**' | |
| web: | |
| - 'web/**' | |
| deploy-api: | |
| needs: changes | |
| if: needs.changes.outputs.api == 'true' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| working-directory: ./api | |
| run: npm ci | |
| - name: Run D1 migrations | |
| working-directory: ./api | |
| run: | | |
| for migration in migrations/*.sql; do | |
| echo "Running migration: $migration" | |
| npx wrangler d1 execute the-stack-db --env production --file="$migration" --remote || true | |
| done | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| - name: Deploy Worker | |
| working-directory: ./api | |
| run: npx wrangler deploy --env production | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| deploy-web: | |
| needs: changes | |
| if: needs.changes.outputs.web == 'true' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| working-directory: ./web | |
| run: npm ci | |
| - name: Build | |
| working-directory: ./web | |
| run: npm run build | |
| env: | |
| PUBLIC_API_URL: https://api.thestack.cl | |
| - name: Deploy Pages | |
| working-directory: ./web | |
| run: npx wrangler pages deploy .svelte-kit/cloudflare --project-name=the-stack-web --commit-dirty=true | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} |