From b6681307d486682817692bbc7ca01a72ef591d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Thu, 5 Sep 2019 00:00:01 +0000 Subject: [PATCH] lazy to finish --- publish-gh-pages | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/publish-gh-pages b/publish-gh-pages index c3a7201..1518eba 100755 --- a/publish-gh-pages +++ b/publish-gh-pages @@ -1,12 +1,32 @@ #!/usr/bin/env bash + # https://cirosantilli.com/linux-kernel-module-cheat#github-pages -set -eu + +set -eux + +gh_pages_dir=out/gh-pages +sha="$(git log -n1 --pretty='%H' master)" + +# Make sure that we can push and build before anything else. git push ./build-doc --github-pages -git checkout gh-pages -git checkout master -- '*.png' _config.yml -cp out/README.html index.html + +# Create or update the gh-pages repository. +mkdir -p "$gh_pages_dir" +if [ -d "${gh_pages_dir}/.git" ]; then + git -C "${gh_pages_dir}" pull +else + git clone --branch gh-pages . "${gh_pages_dir}" +fi + +# Update files in the repository, commit and push. +cp out/README.html "${gh_pages_dir}/index.html" +git checkout master -- \ + .gitignore \ + '*.png' \ + _config.yml \ +; +cd "$gh_pages_dir" git add index.html -git commit --message "$(git log -n1 --pretty='%H' master)" -git push --force -git checkout - +git commit --message "$sha" +#git push