Skip to content

Commit

Permalink
Fix timestamp of HTML theme
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ committed Jul 23, 2022
1 parent f2195c2 commit a42194a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions main.sh
Expand Up @@ -45,6 +45,22 @@ if [ ! -z "$INPUT_REQUIREMENTS_PATH" ] ; then
echo ::endgroup::
fi

# Sphinx HTML builder will rebuild the whole project when modification time
# (mtime) of templates of theme newer than built result. [1]
#
# These theme templates vendored in pip packages are newly installed,
# so their mtime always newr than the built result.
# Set mtime to 1990 to make sure the project won't rebuilt.
#
# .. [1] https://github.com/sphinx-doc/sphinx/blob/5.x/sphinx/builders/html/__init__.py#L417
echo ::group:: Fixing timestamp of HTML theme
site_packages_dir=$(python -c 'import site; print(site.getsitepackages()[0])')
echo Python site-packages directory: $site_packages_dir
for i in $(find $site_packages_dir -name '*.html'); do
touch -m -t 190001010000 $i
echo Fixing timestamp of $i
done

echo ::group:: Creating build directory
build_dir=/tmp/sphinxnotes-pages
mkdir -p $build_dir || true
Expand Down

0 comments on commit a42194a

Please sign in to comment.