Repository navigation
Add Google Analytics video tracking #258
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 to Cloudflare | |
| # Production deploy: build the shelf and ship it to the `orly` Worker (static assets) | |
| # at https://orly.<account-subdomain>.workers.dev. Runs on every push to main and can | |
| # be kicked manually. Needs CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID secrets — until | |
| # those are set, the job no-ops (green) instead of failing. | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: cf-deploy | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check Cloudflare credentials are configured | |
| id: gate | |
| env: | |
| CF_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| run: | | |
| if [ -n "$CF_TOKEN" ]; then | |
| echo "ready=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "ready=false" >> "$GITHUB_OUTPUT" | |
| echo "::notice::CLOUDFLARE_API_TOKEN not set — skipping the Cloudflare deploy." | |
| fi | |
| - if: steps.gate.outputs.ready == 'true' | |
| uses: actions/checkout@v5 | |
| - if: steps.gate.outputs.ready == 'true' | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| - if: steps.gate.outputs.ready == 'true' | |
| run: npm install --no-audit --no-fund | |
| - if: steps.gate.outputs.ready == 'true' | |
| run: npm run build | |
| # Ship the viz Storybook alongside the shelf: served by the same Worker | |
| # at /storybook/ (Storybook builds are relative-path, so a subpath works). | |
| - if: steps.gate.outputs.ready == 'true' | |
| run: npm run build-storybook -- --output-dir dist/storybook | |
| - if: steps.gate.outputs.ready == 'true' | |
| name: Deploy to Cloudflare Workers | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: deploy |