Release to Production #6
Workflow file for this run
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: Release to Production | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # triggers on v2.1.0, v2.2.0, etc. | |
| jobs: | |
| deploy-worker-production: | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| name: Deploy Worker (production) | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| # Fetch full history so we can resolve which branch the tag is on | |
| fetch-depth: 0 | |
| # Check out main explicitly — tag pushes otherwise leave the | |
| # repo in detached HEAD, which Cloudflare Pages sees as "HEAD" | |
| # instead of "main" and fails the production branch check. | |
| ref: main | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: lts/* | |
| - name: Install worker deps | |
| working-directory: worker | |
| run: npm ci | |
| - name: Type-check worker | |
| working-directory: worker | |
| run: npm run type-check | |
| - name: Deploy Worker | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: worker | |
| command: deploy # default env = production | |
| deploy-frontend-production: | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| name: Deploy Frontend (production) | |
| needs: deploy-worker-production | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: lts/* | |
| - name: Install frontend deps | |
| run: npm ci --legacy-peer-deps | |
| - name: Type-check frontend | |
| run: npm run type-check | |
| - name: Build frontend | |
| run: npm run build | |
| env: | |
| VITE_API_URL: ${{ secrets.VITE_API_URL }} | |
| - name: Deploy to Cloudflare Pages (production) | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| wranglerVersion: latest | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: worker | |
| command: pages deploy ../dist --project-name=vibecoded-stocard --branch=main | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true |