2022-01-06 21:55:29 +00:00
|
|
|
# Arguments:
|
|
|
|
# $1 : path to mathlib4 from working directory
|
|
|
|
# $2 : path to doc-gen4 from working directory
|
|
|
|
# $3 : whether to deploy
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
cd $1
|
|
|
|
mathlib_short_git_hash="$(git log -1 --pretty=format:%h)"
|
|
|
|
|
|
|
|
cd ../$2
|
|
|
|
docgen_git_hash="$(git log -1 --pretty=format:%h)"
|
|
|
|
|
|
|
|
cd ../
|
|
|
|
|
|
|
|
git clone "https://github.com/leanprover-community/mathlib4_docs.git" mathlib4_docs
|
|
|
|
|
|
|
|
# skip if docs for this commit have already been generated
|
|
|
|
if [ "$(cd mathlib4_docs && git log -1 --pretty=format:%s)" == "automatic update to mathlib4 $mathlib_short_git_hash using doc-gen4 $docgen_git_hash" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# generate the docs
|
|
|
|
cd $1
|
2022-01-07 09:56:39 +00:00
|
|
|
../$2/build/bin/doc-gen4 /mathlib4_docs/ Mathlib
|
2022-01-06 21:55:29 +00:00
|
|
|
|
|
|
|
if [ "$3" = "true" ]; then
|
2022-01-07 09:32:49 +00:00
|
|
|
cd ..
|
2022-01-06 21:55:29 +00:00
|
|
|
rm -rf mathlib4_docs/docs/
|
|
|
|
cp -r "$1/build/doc" mathlib4_docs/docs
|
|
|
|
mkdir ~/.ssh
|
|
|
|
echo "$MATHLIB4_DOCS_KEY" > ~/.ssh/id_ed25519
|
2022-01-07 09:32:49 +00:00
|
|
|
chmod 600 ~/.ssh/id_ed25519
|
2022-01-06 21:55:29 +00:00
|
|
|
cd mathlib4_docs/docs
|
|
|
|
git remote set-url origin "git@github.com:leanprover-community/mathlib4_docs.git"
|
2022-01-07 09:44:11 +00:00
|
|
|
git config user.email "leanprover.community@gmail.com"
|
|
|
|
git config user.name "leanprover-community-bot"
|
2022-01-06 21:55:29 +00:00
|
|
|
git add -A .
|
|
|
|
git checkout --orphan master2
|
|
|
|
git commit -m "automatic update to mathlib4 $mathlib_short_git_hash using doc-gen4 $docgen_git_hash"
|
|
|
|
git push -f origin HEAD:master
|
|
|
|
fi
|