fix: make the site hold on phones - app-style menu, contained tables,… #37
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-web | |
| # Builds website/ and deploys it to Cloudflare Pages (project "bunmaska", | |
| # which serves bunmaska.org) on pushes that touch the site. Repo secrets: | |
| # CLOUDFLARE_API_TOKEN — scoped token (Pages Edit + DNS Edit + Zone Read) | |
| # CLOUDFLARE_ACCOUNT_ID — 33b4bb12637807398ca2edac6c77fe8c | |
| on: | |
| push: | |
| branches: [main] | |
| paths: ['website/**', '.github/workflows/deploy-web.yml'] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: website | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: .bun-version | |
| - name: Install | |
| run: bun install --frozen-lockfile | |
| # The site is held to the same bar as the framework: biome (ts/tsx) + | |
| # `astro check` (strict tsconfig over every .astro/.ts) gate the deploy. | |
| - name: Install framework dev tools (biome) | |
| run: bun install --frozen-lockfile | |
| working-directory: . | |
| - name: Lint + format-check the site code | |
| run: bunx biome ci website/src | |
| working-directory: . | |
| - name: Type-check the site | |
| run: bun run check | |
| - name: Build the site | |
| run: bun run build | |
| # Run wrangler via bunx (the wrangler-action's npm install is flaky on Bun). | |
| # wrangler reads the token + account id from the env below. | |
| - name: Deploy to Cloudflare Pages | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| run: bunx wrangler@4 pages deploy dist --project-name=bunmaska --branch=main | |
| # IndexNow: one ping tells Bing (and the AI surfaces riding its index - | |
| # Copilot, partly ChatGPT), Yandex, Naver etc. the site changed. Google | |
| # does not participate - the sitemap covers it. Key file lives in public/. | |
| - name: Ping IndexNow with the deployed URLs | |
| run: | | |
| KEY=$(ls dist | grep -E '^[0-9a-f]{32}\.txt$' | head -1 | sed 's/\.txt$//') | |
| grep -oh '<loc>[^<]*' dist/sitemap-*.xml | sed 's/<loc>//' | grep -v '\.xml$' > /tmp/urls.txt | |
| COUNT=$(wc -l < /tmp/urls.txt | tr -d ' ') | |
| python3 -c " | |
| import json, sys | |
| urls = open('/tmp/urls.txt').read().split() | |
| print(json.dumps({'host': 'bunmaska.org', 'key': '$KEY', 'keyLocation': f'https://bunmaska.org/$KEY.txt', 'urlList': urls})) | |
| " > /tmp/indexnow.json | |
| curl -s -w "IndexNow HTTP %{http_code} ($COUNT urls)\n" -o /dev/null \ | |
| -X POST -H "Content-Type: application/json" \ | |
| --data @/tmp/indexnow.json https://api.indexnow.org/indexnow |