Improve wrangler deploy flow to also check for potential (and likel…
#3314
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: Handle Changesets | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| id-token: write | |
| contents: read | |
| # note: no write permissions are needed since the workflow uses GH_ACCESS_TOKEN instead of GITHUB_TOKEN | |
| jobs: | |
| release: | |
| if: ${{ github.repository_owner == 'cloudflare' }} | |
| name: Handle Changesets | |
| runs-on: macos-latest-large | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| # See https://github.com/changesets/action/issues/187 | |
| token: ${{ secrets.GH_ACCESS_TOKEN }} | |
| # Pull in more history to cover the changeset commits | |
| fetch-depth: 500 | |
| - name: Install Dependencies | |
| uses: ./.github/actions/install-dependencies | |
| with: | |
| node-version: 24 | |
| turbo-api: ${{ secrets.TURBO_API }} | |
| turbo-team: ${{ secrets.TURBO_TEAM }} | |
| turbo-token: ${{ secrets.TURBO_TOKEN }} | |
| turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} | |
| - name: Check npm version | |
| run: node -r esbuild-register tools/deployments/check-npm-version.ts | |
| - name: Check the changesets | |
| run: node -r esbuild-register tools/deployments/validate-changesets.ts | |
| - name: Build all packages | |
| run: pnpm run build | |
| env: | |
| CI_OS: ${{ runner.os }} | |
| SOURCEMAPS: "false" | |
| ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} | |
| ALGOLIA_PUBLIC_KEY: ${{ secrets.ALGOLIA_PUBLIC_KEY }} | |
| SENTRY_DSN: "https://[email protected]/583" | |
| NODE_ENV: "production" | |
| # This is the "production" key for sparrow analytics. | |
| # Include this here because this step will rebuild Wrangler and needs to have this available | |
| SPARROW_SOURCE_KEY: "50598e014ed44c739ec8074fdc16057c" | |
| - name: Create Version PR or Publish to NPM | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: node .github/changeset-version.js | |
| publish: pnpm exec changeset publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
| - name: Deploy non-NPM Packages | |
| id: deploy | |
| run: | | |
| node -r esbuild-register tools/deployments/deploy-non-npm-packages.ts | |
| echo "status=$(cat deployment-status.json)" >> $GITHUB_OUTPUT; | |
| env: | |
| PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| WORKERS_NEW_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.WORKERS_NEW_CLOUDFLARE_ACCOUNT_ID }} | |
| WORKERS_NEW_CLOUDFLARE_API_TOKEN: ${{ secrets.WORKERS_NEW_CLOUDFLARE_API_TOKEN }} | |
| WORKERS_DEPLOY_AND_CONFIG_CLOUDFLARE_API_TOKEN: ${{ secrets.WORKERS_DEPLOY_AND_CONFIG_CLOUDFLARE_API_TOKEN }} | |
| WORKERS_SHARED_SENTRY_ACCESS_ID: ${{ secrets.WORKERS_SHARED_SENTRY_ACCESS_ID }} | |
| WORKERS_SHARED_SENTRY_ACCESS_SECRET: ${{ secrets.WORKERS_SHARED_SENTRY_ACCESS_SECRET }} | |
| WORKERS_SHARED_SENTRY_AUTH_TOKEN: ${{ secrets.WORKERS_SHARED_SENTRY_AUTH_TOKEN }} | |
| - name: Send Alert | |
| if: always() | |
| run: node -r esbuild-register tools/deployments/alert-on-error.ts | |
| env: | |
| PUBLISH_STATUS: ${{ steps.changesets.outcome }} | |
| DEPLOYMENT_STATUS: ${{ steps.deploy.outputs.status }} | |
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| TOKEN: ${{ secrets.STATUS_BOT_SECRET }} |