Skip to content

Commit

Permalink
Fix broken changes.html
Browse files Browse the repository at this point in the history
  • Loading branch information
kwankyu committed Jun 25, 2024
1 parent 501573e commit d2d1514
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .ci/create-changes-html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ fi
BASE_DOC_COMMIT="$1"
DOC_REPOSITORY="$2"

# Wipe out chronic diffs between old doc and new doc
(cd $DOC_REPOSITORY && find . -name "*.html" | xargs sed -i -e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d')
# Create CHANGES.html
echo '<html>' > CHANGES.html
echo '<head>' >> CHANGES.html
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:
git init && \
(echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && \
(echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; \
git add -A && git commit --quiet -m "old")
git add -A && git commit --quiet -m 'old')
- name: Build doc
id: docbuild
Expand All @@ -175,13 +175,16 @@ jobs:
docker cp --follow-link BUILD:/sage/local/share/doc/sage/html doc
docker cp --follow-link BUILD:/sage/local/share/doc/sage/index.html doc
(cd doc && git commit -a -m 'new')
# Wipe out chronic diffs of new doc against old doc
# Wipe out chronic diffs of new doc against old doc before creating CHANGES.html
(cd doc && \
find . -name "*.html" | xargs sed -i -e '/This is documentation for/ s/ built with GitHub PR .*. Doc/. Doc/' \
-e '/<link rel="stylesheet"/ s/?v=[0-9a-f]*"/"/')
.ci/create-changes-html.sh $(cd doc && git rev-parse HEAD^) doc
# Restore the new doc from changes by "wipe out"
(cd doc && git checkout -f)
-e '/<link rel="stylesheet"/ s/?v=[0-9a-f]*"/"/' \
-e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d' \
&& git commit -a -m 'wipe-out')
# Since HEAD is at commit 'wipe-out', HEAD~1 is commit 'new' (new doc), HEAD~2 is commit 'old' (old doc)
.ci/create-changes-html.sh $(cd doc && git rev-parse HEAD~2) doc
# Restore the new doc with changes made in create-changes-html.sh but dropping changes by "wipe out"
(cd doc && git stash -q && git checkout -q -f HEAD~1 && git stash pop -q)
# Sometimes rm -rf .git errors out because of some diehard hidden files
# So we simply move it out of the doc directory
(cd doc && mv .git ../git && mv .gitattributes ../gitattributes)
Expand Down

0 comments on commit d2d1514

Please sign in to comment.