77 exit 1;
88};
99
10- echo " pwd"
11- pwd
12-
1310docs_src=$GITHUB_WORKSPACE /docs
1411docs_html=$GITHUB_WORKSPACE /gh-pages
1512sphinx_doctree=$GITHUB_WORKSPACE /.doctree
1613
14+ echo ::group::Create working directories
1715echo " mkdir $docs_src "
1816mkdir $docs_src
1917echo " mkdir $docs_html "
2018mkdir $docs_html
2119echo " mkdir $sphinx_doctree "
2220mkdir $sphinx_doctree
21+ echo ::endgroup::
2322
2423# checkout branch docs
24+ echo ::group::Initializing the repository
2525echo " cd $docs_src "
2626cd $docs_src
2727echo " git init"
2828git init
2929echo " git remote add origin https://github.com/$GITHUB_REPOSITORY .git"
3030git remote add origin https://$GITHUB_ACTOR :$INPUT_GITHUB_TOKEN @github.com/$GITHUB_REPOSITORY .git
31+ echo ::endgroup::
32+ echo ::group::Fetching the repository
3133echo " git fetch origin +$GITHUB_SHA :refs/remotes/origin/docs"
3234git fetch origin +$GITHUB_SHA :refs/remotes/origin/docs
35+ echo ::endgroup::
36+ echo ::group::Checkout ref
3337echo " git checkout -B docs refs/remotes/origin/docs"
3438git checkout -B docs refs/remotes/origin/docs
35- echo " git log -1"
39+ echo ::endgroup::
40+ echo ::group::Show HEAD message
3641git log -1
42+ echo ::endgroup::
3743
3844# get author
3945author_name=" $( git show --format=%an -s) "
@@ -47,53 +53,75 @@ echo "::set-output name=docs_sha::$(echo ${GITHUB_SHA})"
4753echo " ::set-output name=docs_sha8::" $docs_sha8 " "
4854
4955# checkout branch gh-pages
56+ echo ::group::Initializing branch gh-pages
5057echo " cd $docs_html "
5158cd $docs_html
5259echo " git init"
5360git init
5461echo " git remote add origin https://github.com/$GITHUB_REPOSITORY .git"
5562git remote add origin https://$GITHUB_ACTOR :$INPUT_GITHUB_TOKEN @github.com/$GITHUB_REPOSITORY .git
63+ echo ::endgroup::
5664
5765# check remote branch exist first
58- echo " Checking remote branch gh-pages."
66+ echo ::group::Check remote branch gh-pages exist
67+ echo " git ls-remote --heads origin refs/heads/gh-pages"
5968gh_pages_exist=$( git ls-remote --heads origin refs/heads/gh-pages)
69+ if [ -z " $gh_pages_exist " ]
70+ then
71+ echo " Not exist."
72+ else
73+ echo " Exist"
74+ fi
75+ echo ::endgroup::
76+
6077if [ -z " $gh_pages_exist " ]
6178then
62- echo " -> remote branch gh-pages not exist, auto create. "
79+ echo ::group::Create branch gh-pages
6380 echo " git checkout -B gh-pages"
6481 git checkout -B gh-pages
82+ echo ::endgroup::
6583else
66- echo " -> remote branch gh-pages exist, fetch. "
84+ echo ::group::Fetching branch gh-pages
6785 echo " git fetch origin +refs/heads/gh-pages:refs/remotes/origin/gh-pages"
6886 git fetch origin +refs/heads/gh-pages:refs/remotes/origin/gh-pages
6987 echo " git checkout -B gh-pages refs/remotes/origin/gh-pages"
7088 git checkout -B gh-pages refs/remotes/origin/gh-pages
7189 echo " git log -1"
7290 git log -1
91+ echo ::endgroup::
7392fi
7493
7594# git config
95+ echo ::group::Set commiter
7696echo " git config user.name $author_name "
7797git config user.name $author_name
7898echo " git config user.email $author_email "
7999git config user.email $author_email
100+ echo ::endgroup::
80101
81102# sphinx-build
103+ echo ::group::Sphinx build html
82104echo " sphinx-build -b html $docs_src /source $docs_html -E -d $sphinx_doctree "
83105sphinx-build -b html $docs_src /source $docs_html -E -d $sphinx_doctree
106+ echo ::endgroup::
84107
85108# auto creation of README.md
86109if [ " $INPUT_CREATE_README " = true ] ; then
87- echo " Create file README.md"
110+ echo ::group::Create README
111+ echo " Create file README.md with these content"
88112 echo " GitHub Pages of [$GITHUB_REPOSITORY ](https://github.com/$GITHUB_REPOSITORY .git)" > README.md
89113 echo " ===" >> README.md
90114 echo " Sphinx html documentation of [$docs_sha8 ](https://github.com/$GITHUB_REPOSITORY /tree/$GITHUB_SHA )" >> README.md
115+ cat README.md
116+ echo ::endgroup::
91117fi
92118
93119# commit and push
120+ echo ::group::Push
94121echo " git add ."
95122git add .
96- echo ' git commit --allow-empty -m "From $GITHUB_REF"'
123+ echo ' git commit --allow-empty -m "From $GITHUB_REF $docs_sha8 "'
97124git commit --allow-empty -m " From $GITHUB_REF $docs_sha8 "
98125echo " git push origin gh-pages"
99126git push origin gh-pages
127+ echo ::endgroup::
0 commit comments