chore(deps)(deps-dev): bump @next/bundle-analyzer from 15.5.9 to 16.1.1 #98
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 Preview | |
| on: | |
| pull_request: | |
| push: | |
| branches-ignore: [main, develop] | |
| concurrency: | |
| group: preview-${{ github.event.pull_request.number || github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| name: Deploy Preview to Cloudflare Workers | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| deployments: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Compute preview identifiers | |
| id: preview_meta | |
| run: | | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| CF_BRANCH="pr-${{ github.event.pull_request.number }}" | |
| CONTEXT_LABEL="PR #${{ github.event.pull_request.number }}" | |
| else | |
| RAW_BRANCH="${{ github.ref_name }}" | |
| SLUG="$(echo "$RAW_BRANCH" | tr '[:upper:]' '[:lower:]' | sed -E 's#[^a-z0-9]+#-#g; s#(^-+|-+$)##g' | cut -c1-40)" | |
| if [[ -z "$SLUG" ]]; then | |
| SLUG="branch" | |
| fi | |
| CF_BRANCH="br-$SLUG" | |
| CONTEXT_LABEL="Branch $RAW_BRANCH" | |
| fi | |
| # Cloudflare Preview URLs (aliased) format: | |
| # <ALIAS>-<WORKER_NAME>.<SUBDOMAIN>.workers.dev | |
| # See: https://developers.cloudflare.com/workers/configuration/previews/ | |
| PREVIEW_ALIAS="$CF_BRANCH" | |
| WORKER_NAME="aicodingstack" | |
| PREVIEW_URL="https://${PREVIEW_ALIAS}-${WORKER_NAME}.pr-preview.workers.dev" | |
| { | |
| echo "cf_branch=$CF_BRANCH" | |
| echo "worker_name=$WORKER_NAME" | |
| echo "preview_alias=$PREVIEW_ALIAS" | |
| echo "preview_url=$PREVIEW_URL" | |
| echo "context_label=$CONTEXT_LABEL" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run CI tests | |
| run: npm run test:ci | |
| - name: Build with OpenNext | |
| run: npm run build | |
| env: | |
| BUILD_TIME: ${{ github.event.pull_request.updated_at || github.event.head_commit.timestamp }} | |
| - name: Deploy Preview | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: versions upload --preview-alias ${{ steps.preview_meta.outputs.preview_alias }} | |
| - name: Comment Preview URL | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| env: | |
| PREVIEW_URL: ${{ steps.preview_meta.outputs.preview_url }} | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const previewUrl = process.env.PREVIEW_URL; | |
| const commitSha = context.sha.substring(0, 7); | |
| // Find existing bot comment | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| }); | |
| const botComment = comments.find(c => | |
| c.user.type === 'Bot' && c.body.includes('Preview deployment') | |
| ); | |
| const body = `### Preview deployment | |
| | Status | URL | | |
| |--------|-----| | |
| | Ready | [${previewUrl}](${previewUrl}) | | |
| **Commit:** \`${commitSha}\` | |
| **Updated:** ${new Date().toISOString()}`; | |
| if (botComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body | |
| }); | |
| } | |
| - name: Deployment summary | |
| run: | | |
| echo "### Preview Deployment" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Context:** ${{ steps.preview_meta.outputs.context_label }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **URL:** ${{ steps.preview_meta.outputs.preview_url }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY |