perf(search): rarity is evidence, not proof #163
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: IndexNow on deploy | |
| # On every push to master (which also triggers the Cloudflare Pages deploy), | |
| # rebuild both editions to regenerate their sitemap.xml, wait for the new | |
| # content to actually go live, then submit the URLs to IndexNow (Bing/Yandex/ | |
| # Seznam). Google is not an IndexNow consumer — it is driven by the sitemaps in | |
| # Search Console, which Cloudflare regenerates on each deploy. | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| # Only the most recent push needs to ping; cancel any in-flight older run. | |
| concurrency: | |
| group: indexnow | |
| cancel-in-progress: true | |
| jobs: | |
| ping: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - run: npm ci | |
| - name: Build both editions (regenerates sitemap.xml for org + com) | |
| run: npm run build:all | |
| - name: Wait for the Cloudflare Pages deploy to go live | |
| # Poll each live sitemap until its set of page URLs matches the freshly | |
| # built one (lastmod/ordering ignored), so we only ping once the deploy | |
| # actually reflects this commit. Falls through after ~12 min so a slow | |
| # deploy never blocks the ping (IndexNow crawls asynchronously anyway). | |
| # | |
| # Both sides go through indexnow-ping.js --print-urls rather than grepping | |
| # <loc> here: .org's sitemap.xml is an INDEX, so a raw grep would compare | |
| # three child-sitemap names that change almost never, and the gate would | |
| # pass before a single page was live. | |
| run: | | |
| set -u | |
| built_urls() { node scripts/indexnow-ping.js "$1" --print-urls 2>/dev/null; } | |
| live_urls() { node scripts/indexnow-ping.js "$1" --print-urls --live 2>/dev/null; } | |
| wait_host() { | |
| edition="$1"; host="$2" | |
| want="$(built_urls "$edition")" | |
| for i in $(seq 1 48); do | |
| if [ "$(live_urls "$edition")" = "$want" ]; then | |
| echo "$host: deploy is live (attempt $i)"; return 0 | |
| fi | |
| echo "$host: waiting for deploy… ($i/48)"; sleep 15 | |
| done | |
| echo "::warning::$host deploy not confirmed within timeout — pinging anyway" | |
| } | |
| wait_host com imqueue.com | |
| wait_host org imqueue.org | |
| - name: Submit URLs to IndexNow | |
| run: npm run indexnow:com && npm run indexnow:org |