From 5c1af388fa0fef77c658f4ace14a2c7c974fe48f Mon Sep 17 00:00:00 2001 From: ZhouGuangyuan Date: Sat, 22 Aug 2026 12:56:38 +0800 Subject: [PATCH] ci: prevent stale jobs from rolling back Pages --- .github/workflows/llgo-binary-size-pages.yml | 3 +++ .github/workflows/llgo-binary-size.yml | 1 + ci/llgo-compatibility/publish.sh | 7 ++++++- ci/llgo-performance/publish.sh | 7 ++++++- ci/llgo-size/publish.sh | 7 ++++++- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/llgo-binary-size-pages.yml b/.github/workflows/llgo-binary-size-pages.yml index 96b6ace..130dc2b 100644 --- a/.github/workflows/llgo-binary-size-pages.yml +++ b/.github/workflows/llgo-binary-size-pages.yml @@ -6,6 +6,9 @@ on: - main paths: - ci/llgo-size/site/** + - ci/llgo-size/publish.sh + - ci/llgo-performance/publish.sh + - ci/llgo-compatibility/publish.sh - ci/llgo-size/publish-site.sh - ci/llgo-size/enrich_pull_requests.py - ci/llgo-size/prepare-pages-branch.sh diff --git a/.github/workflows/llgo-binary-size.yml b/.github/workflows/llgo-binary-size.yml index 167285a..821acc8 100644 --- a/.github/workflows/llgo-binary-size.yml +++ b/.github/workflows/llgo-binary-size.yml @@ -6,6 +6,7 @@ on: - main paths-ignore: - ci/llgo-size/site/** + - ci/llgo-size/publish.sh - ci/llgo-size/publish-site.sh - ci/llgo-size/prepare-pages-branch.sh - ci/llgo-performance/** diff --git a/ci/llgo-compatibility/publish.sh b/ci/llgo-compatibility/publish.sh index 21d1bcf..a6d728c 100755 --- a/ci/llgo-compatibility/publish.sh +++ b/ci/llgo-compatibility/publish.sh @@ -83,8 +83,13 @@ with open(os.path.join(data_dir, "index.json"), "w", encoding="utf-8") as destin destination.write("\n") PY +# Result jobs can finish long after a newer site revision has been published. +# Seed a brand-new Pages branch, but leave existing static assets to the +# dedicated Pages workflow so an old result job cannot roll the UI back. for file in index.html app.js performance.html performance.js compatibility.html compatibility.js style.css _config.yml; do - cp "$site_dir/$file" "$pages_dir/$file" + if [[ ! -e "$pages_dir/$file" ]]; then + cp "$site_dir/$file" "$pages_dir/$file" + fi done rm -f "$pages_dir/.nojekyll" diff --git a/ci/llgo-performance/publish.sh b/ci/llgo-performance/publish.sh index daf377d..aa43196 100755 --- a/ci/llgo-performance/publish.sh +++ b/ci/llgo-performance/publish.sh @@ -86,8 +86,13 @@ with open(os.path.join(data_dir, "index.json"), "w", encoding="utf-8") as destin destination.write("\n") PY +# Result jobs can finish long after a newer site revision has been published. +# Seed a brand-new Pages branch, but leave existing static assets to the +# dedicated Pages workflow so an old result job cannot roll the UI back. for file in index.html app.js performance.html performance.js compatibility.html compatibility.js style.css _config.yml; do - cp "$site_dir/$file" "$pages_dir/$file" + if [[ ! -e "$pages_dir/$file" ]]; then + cp "$site_dir/$file" "$pages_dir/$file" + fi done rm -f "$pages_dir/.nojekyll" diff --git a/ci/llgo-size/publish.sh b/ci/llgo-size/publish.sh index 30c559b..18c0e72 100755 --- a/ci/llgo-size/publish.sh +++ b/ci/llgo-size/publish.sh @@ -65,8 +65,13 @@ for source in sorted(os.listdir(runs_dir)): continue os.rename(source_dir, target_dir) PY +# Result jobs can finish long after a newer site revision has been published. +# Seed a brand-new Pages branch, but leave existing static assets to the +# dedicated Pages workflow so an old result job cannot roll the UI back. for file in index.html app.js performance.html performance.js compatibility.html compatibility.js style.css _config.yml; do - cp "$site_dir/$file" "$pages_dir/$file" + if [[ ! -e "$pages_dir/$file" ]]; then + cp "$site_dir/$file" "$pages_dir/$file" + fi done rm -f "$pages_dir/.nojekyll"