Skip to content

Commit 1490aaf

Browse files
ci(deploy): integrate domain warmup into deployment workflow
Add warmup step to GitHub Pages deployment workflow that runs after publication. Includes Node.js setup, warmup execution with summary output, and enhanced deployment status reporting that captures both publish and warmup outcomes. Co-Authored-By: Hagicode <noreply@hagicode.com> Signed-off-by: newbe36524 <newbe36524@qq.com>
1 parent 1ed5202 commit 1490aaf

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

.github/workflows/docs-deploy-gh-pages.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,19 @@ jobs:
7171
with:
7272
fetch-depth: 0
7373

74+
- name: Setup Node.js
75+
uses: actions/setup-node@v4
76+
with:
77+
node-version: ${{ env.NODE_VERSION }}
78+
7479
- name: Download validated gh-pages payload
7580
uses: actions/download-artifact@v4
7681
with:
7782
name: docs-gh-pages-payload
7883
path: .deploy/gh-pages
7984

8085
- name: Publish validated gh-pages payload
86+
id: publish-gh-pages
8187
uses: peaceiris/actions-gh-pages@v4
8288
with:
8389
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -86,12 +92,37 @@ jobs:
8692
force_orphan: true
8793
enable_jekyll: false
8894

95+
- name: Warm deployment domains
96+
id: warmup
97+
run: node ./scripts/warm-deployment-domains.mjs --summary-markdown ./.deploy/docs-warmup-summary.md
98+
8999
- name: Summarize deployment output
100+
if: always()
101+
env:
102+
PUBLISH_OUTCOME: ${{ steps.publish-gh-pages.outcome }}
103+
WARMUP_OUTCOME: ${{ steps.warmup.outcome }}
104+
WARMUP_SUMMARY_MARKDOWN: ./.deploy/docs-warmup-summary.md
90105
run: |
91106
echo "## Publication status" >> "$GITHUB_STEP_SUMMARY"
92107
echo "- Publication source: validated build artifact" >> "$GITHUB_STEP_SUMMARY"
93-
echo "- \`gh-pages\` publication: succeeded" >> "$GITHUB_STEP_SUMMARY"
108+
echo "- \`gh-pages\` publication: ${PUBLISH_OUTCOME}" >> "$GITHUB_STEP_SUMMARY"
94109
echo "- Published payload: branch-root \`esa.jsonc\`, \`wrangler.jsonc\`, plus \`dist/\`" >> "$GITHUB_STEP_SUMMARY"
95110
echo "- GitHub environment: docs-production" >> "$GITHUB_STEP_SUMMARY"
96111
echo "- Expected public URL: https://docs.hagicode.com" >> "$GITHUB_STEP_SUMMARY"
97-
echo "Published the validated gh-pages payload with ./esa.jsonc, ./wrangler.jsonc, and ./dist/."
112+
echo "- Post-publication warmup: ${WARMUP_OUTCOME}" >> "$GITHUB_STEP_SUMMARY"
113+
if [ -f "$WARMUP_SUMMARY_MARKDOWN" ]; then
114+
echo "" >> "$GITHUB_STEP_SUMMARY"
115+
cat "$WARMUP_SUMMARY_MARKDOWN" >> "$GITHUB_STEP_SUMMARY"
116+
elif [ "$PUBLISH_OUTCOME" = "success" ]; then
117+
echo "" >> "$GITHUB_STEP_SUMMARY"
118+
echo "## Deployment domain warmup" >> "$GITHUB_STEP_SUMMARY"
119+
echo "- Warmup summary file was not created." >> "$GITHUB_STEP_SUMMARY"
120+
fi
121+
if [ "$PUBLISH_OUTCOME" = "success" ] && [ "$WARMUP_OUTCOME" = "failure" ]; then
122+
echo "- Publication note: gh-pages snapshot was already published before warmup verification failed." >> "$GITHUB_STEP_SUMMARY"
123+
fi
124+
if [ "$PUBLISH_OUTCOME" = "success" ]; then
125+
echo "Published the validated gh-pages payload with ./esa.jsonc, ./wrangler.jsonc, and ./dist/."
126+
else
127+
echo "Validated gh-pages publication did not complete successfully."
128+
fi

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"test:desktop-version-guidance": "node --test ./tests/desktop-version-guidance.test.mjs",
5050
"test:docs-translation-report": "node --test ./tests/docs-translation-report.test.mjs",
5151
"test:indexnow": "node --test ./tests/submit-indexnow.test.mjs",
52+
"test:warm-deployment-domains": "node --test ./tests/warm-deployment-domains.test.mjs",
5253
"verify:blog-sidebar-i18n": "node ./scripts/verify-blog-sidebar-i18n.mjs",
5354
"verify:blog-i18n-completeness": "node ./scripts/verify-blog-i18n-completeness.mjs",
5455
"report:translation": "node ./scripts/report-translation-status.mjs",

0 commit comments

Comments
 (0)