CI: change deploy marker logic
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy (3.114.12) (push) Has been cancelled

This commit is contained in:
SukkaW
2026-06-27 22:21:49 +08:00
parent 689dc2e2ac
commit 27782e993b

View File

@@ -174,7 +174,7 @@ jobs:
- name: Prepare GitHub Pages deployment marker - name: Prepare GitHub Pages deployment marker
id: deploy_marker id: deploy_marker
run: | run: |
echo "marker_file=deploy-check-${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}.txt" >> $GITHUB_OUTPUT echo "marker_content=${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> $GITHUB_OUTPUT
- name: Remove build artifact - name: Remove build artifact
uses: geekyeggo/delete-artifact@v6 uses: geekyeggo/delete-artifact@v6
background: true background: true
@@ -224,7 +224,7 @@ jobs:
rm -rf ./* rm -rf ./*
cp -rf ../public/* ./ cp -rf ../public/* ./
echo "ruleset-mirror.skk.moe" > CNAME echo "ruleset-mirror.skk.moe" > CNAME
: > "${{ steps.deploy_marker.outputs.marker_file }}" echo "${{ steps.deploy_marker.outputs.marker_content }}" > deploy-check.txt
git add --all . git add --all .
git commit -m "deploy: https://github.com/SukkaW/Surge/commit/${GITHUB_SHA}" git commit -m "deploy: https://github.com/SukkaW/Surge/commit/${GITHUB_SHA}"
git push --quiet --force origin HEAD:master git push --quiet --force origin HEAD:master
@@ -239,18 +239,19 @@ jobs:
if: steps.upload_dist_to_github.outcome == 'success' if: steps.upload_dist_to_github.outcome == 'success'
id: wait_for_github_pages id: wait_for_github_pages
run: | run: |
marker_file="${{ steps.deploy_marker.outputs.marker_file }}" expected="${{ steps.deploy_marker.outputs.marker_content }}"
marker_url="https://ruleset-mirror.skk.moe/${marker_file}" marker_url="https://ruleset-mirror.skk.moe/deploy-check.txt"
for _ in $(seq 1 30); do for _ in $(seq 1 30); do
if curl --fail --silent --show-error --location --head "${marker_url}" >/dev/null; then content=$(curl --fail --silent --show-error --location "${marker_url}" || true)
echo "GitHub Pages is serving ${marker_file}" if [ "${content}" = "${expected}" ]; then
echo "GitHub Pages is serving the correct deploy marker"
exit 0 exit 0
fi fi
sleep 10 sleep 10
done done
echo "Timed out waiting for GitHub Pages deployment: ${marker_url}" echo "Timed out waiting for GitHub Pages deployment"
exit 1 exit 1
- name: Archive dist repo - name: Archive dist repo
if: steps.wait_for_github_pages.outcome == 'success' if: steps.wait_for_github_pages.outcome == 'success'