Skip to content

Commit 90890e0

Browse files
committed
Prevent incomplete Pages deployments
Always regenerate gitignored HTML before uploading the Pages artifact, and fail the build if the homepage is missing.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 0b2b16b commit 90890e0

1 file changed

Lines changed: 7 additions & 23 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,14 @@ jobs:
3636
with:
3737
fetch-depth: 2
3838

39-
- name: Detect changed paths
39+
- name: Prepare generation
4040
id: changes
4141
run: |
42-
# OG images are gitignored and must always be regenerated
42+
# Generated HTML and OG images are gitignored, so every deployment
43+
# must recreate them before replacing the current Pages artifact.
44+
echo "generate=true" >> "$GITHUB_OUTPUT"
4345
echo "og=true" >> "$GITHUB_OUTPUT"
4446
45-
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
46-
echo "generate=true" >> "$GITHUB_OUTPUT"
47-
elif [[ "${{ github.event_name }}" == "workflow_run" ]]; then
48-
# Generator JAR was rebuilt — regenerate HTML
49-
echo "generate=true" >> "$GITHUB_OUTPUT"
50-
else
51-
# Push event — check which files changed
52-
CHANGED=$(git diff --name-only HEAD~1 HEAD)
53-
echo "Changed files:"
54-
echo "$CHANGED"
55-
56-
NEEDS_GENERATE=false
57-
58-
if echo "$CHANGED" | grep -qE '^(content/|translations/|templates/|html-generators/tags\.properties|html-generators/categories\.properties)'; then
59-
NEEDS_GENERATE=true
60-
fi
61-
62-
echo "generate=$NEEDS_GENERATE" >> "$GITHUB_OUTPUT"
63-
fi
64-
echo "Summary: generate=${{ steps.changes.outputs.generate || 'pending' }}, og=${{ steps.changes.outputs.og || 'pending' }}"
65-
6647
- uses: actions/setup-java@v6
6748
if: steps.changes.outputs.generate == 'true' || steps.changes.outputs.og == 'true'
6849
with:
@@ -117,6 +98,9 @@ jobs:
11798
fi
11899
jbang html-generators/generateog.java
119100
101+
- name: Verify Pages artifact
102+
run: test -s site/index.html
103+
120104
- name: Setup Pages
121105
uses: actions/configure-pages@v6
122106

0 commit comments

Comments
 (0)