flue.sh and README as one plain document (#137) #19
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
| # Deploys flue.sh when the site or the installer changes on main. | |
| # | |
| # Requires the CLOUDFLARE_API_TOKEN repo secret (Workers Scripts: Edit). | |
| # The secret is optional: without it the job skips rather than fails, but | |
| # loudly — a warning annotation, not a silent green run, because until a | |
| # deploy lands, flue.sh and the README's install one-liner 404. `make | |
| # site-deploy` from locally-authed wrangler is the baseline path. | |
| name: deploy-site | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "site/**" | |
| - "scripts/install.sh" | |
| - ".github/workflows/deploy-site.yml" | |
| permissions: | |
| contents: read | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Check for the deploy token | |
| id: token | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| run: | | |
| if [ -n "$CLOUDFLARE_API_TOKEN" ]; then | |
| echo "present=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "present=false" >> "$GITHUB_OUTPUT" | |
| # A warning annotation, so the skip shows up on the run summary | |
| # instead of hiding inside a green checkmark. | |
| echo "::warning::CLOUDFLARE_API_TOKEN is not set; skipping the deploy." \ | |
| "flue.sh stays unpublished until a deploy runs — 'make site-deploy' from locally-authed wrangler is the baseline." | |
| fi | |
| - name: Install the toolchain from mise.toml | |
| if: steps.token.outputs.present == 'true' | |
| uses: jdx/mise-action@v4 | |
| # mise-action caches the tools it installs, but not the pnpm store; | |
| # cache it separately, keyed on the lockfile. | |
| - name: Locate the pnpm store | |
| if: steps.token.outputs.present == 'true' | |
| id: pnpm-store | |
| run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT" | |
| - name: Cache the pnpm store | |
| if: steps.token.outputs.present == 'true' | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.path }} | |
| key: pnpm-store-site-${{ runner.os }}-${{ hashFiles('site/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| pnpm-store-site-${{ runner.os }}- | |
| - name: Test the installer before serving it | |
| if: steps.token.outputs.present == 'true' | |
| run: bash scripts/install_test.sh | |
| # The site is a prerendered TanStack Start app: wrangler serves | |
| # dist/client, which only exists after a vite build, and the installer | |
| # must be copied in after that build or vite's clean of dist/ takes it. | |
| # make site-deploy is the one recipe that gets this ordering right — | |
| # the same one the locally-authed path runs — so CI runs it verbatim. | |
| - name: Build and deploy | |
| if: steps.token.outputs.present == 'true' | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| run: make site-deploy |