Skip to content
This repository was archived by the owner on Dec 25, 2021. It is now read-only.

Commit 70dd055

Browse files
committed
Add group command
1 parent 39cb32c commit 70dd055

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

entrypoint.sh

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,39 @@ set -e
77
exit 1;
88
};
99

10-
echo "pwd"
11-
pwd
12-
1310
docs_src=$GITHUB_WORKSPACE/docs
1411
docs_html=$GITHUB_WORKSPACE/gh-pages
1512
sphinx_doctree=$GITHUB_WORKSPACE/.doctree
1613

14+
echo ::group::Create working directories
1715
echo "mkdir $docs_src"
1816
mkdir $docs_src
1917
echo "mkdir $docs_html"
2018
mkdir $docs_html
2119
echo "mkdir $sphinx_doctree"
2220
mkdir $sphinx_doctree
21+
echo ::endgroup::
2322

2423
# checkout branch docs
24+
echo ::group::Initializing the repository
2525
echo "cd $docs_src"
2626
cd $docs_src
2727
echo "git init"
2828
git init
2929
echo "git remote add origin https://github.com/$GITHUB_REPOSITORY.git"
3030
git remote add origin https://$GITHUB_ACTOR:$INPUT_GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git
31+
echo ::endgroup::
32+
echo ::group::Fetching the repository
3133
echo "git fetch origin +$GITHUB_SHA:refs/remotes/origin/docs"
3234
git fetch origin +$GITHUB_SHA:refs/remotes/origin/docs
35+
echo ::endgroup::
36+
echo ::group::Checkout ref
3337
echo "git checkout -B docs refs/remotes/origin/docs"
3438
git checkout -B docs refs/remotes/origin/docs
35-
echo "git log -1"
39+
echo ::endgroup::
40+
echo ::group::Show HEAD message
3641
git log -1
42+
echo ::endgroup::
3743

3844
# get author
3945
author_name="$(git show --format=%an -s)"
@@ -47,53 +53,75 @@ echo "::set-output name=docs_sha::$(echo ${GITHUB_SHA})"
4753
echo "::set-output name=docs_sha8::"$docs_sha8""
4854

4955
# checkout branch gh-pages
56+
echo ::group::Initializing branch gh-pages
5057
echo "cd $docs_html"
5158
cd $docs_html
5259
echo "git init"
5360
git init
5461
echo "git remote add origin https://github.com/$GITHUB_REPOSITORY.git"
5562
git 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"
5968
gh_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+
6077
if [ -z "$gh_pages_exist" ]
6178
then
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::
6583
else
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::
7392
fi
7493

7594
# git config
95+
echo ::group::Set commiter
7696
echo "git config user.name $author_name"
7797
git config user.name $author_name
7898
echo "git config user.email $author_email"
7999
git config user.email $author_email
100+
echo ::endgroup::
80101

81102
# sphinx-build
103+
echo ::group::Sphinx build html
82104
echo "sphinx-build -b html $docs_src/source $docs_html -E -d $sphinx_doctree"
83105
sphinx-build -b html $docs_src/source $docs_html -E -d $sphinx_doctree
106+
echo ::endgroup::
84107

85108
# auto creation of README.md
86109
if [ "$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::
91117
fi
92118

93119
# commit and push
120+
echo ::group::Push
94121
echo "git add ."
95122
git add .
96-
echo 'git commit --allow-empty -m "From $GITHUB_REF"'
123+
echo 'git commit --allow-empty -m "From $GITHUB_REF $docs_sha8"'
97124
git commit --allow-empty -m "From $GITHUB_REF $docs_sha8"
98125
echo "git push origin gh-pages"
99126
git push origin gh-pages
127+
echo ::endgroup::

0 commit comments

Comments
 (0)