-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (55 loc) · 2.39 KB
/
Copy pathindexnow.yml
File metadata and controls
64 lines (55 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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@v4
- uses: actions/setup-node@v4
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