fix bug in plan copy #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docs | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
name: Deploy docs | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: setting the committer name and email | |
id: committer | |
shell: bash | |
run: | | |
author_name="$(git show --format=%an -s)" | |
author_email="$(git show --format=%ae -s)" | |
echo "::group::Set committer" | |
echo "git config user.name \"$author_name\"" | |
git config user.name "$author_name" | |
echo "git config user.email \"$author_email\"" | |
git config user.email "$author_email" | |
echo "::endgroup::" | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
pip install sphinx cloud_sptheme | |
- name: Sphinx build | |
shell: bash | |
working-directory: ./docs | |
run: | | |
echo ::group::Sphinx docs compilation | |
make html | |
echo ::endgroup:: | |
- name: Deploy | |
shell: bash | |
run: | | |
echo ::group::Create README for gh-pages | |
SHA=$GITHUB_SHA | |
echo "$SHA $GITHUB_EVENT_NAME" | |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then | |
SHA=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha) | |
fi | |
SHORT_SHA="$(git rev-parse --short $SHA)" | |
DIR_HTML=docs/build/html/ | |
echo "#GitHub Pages" > $DIR_HTML/README.md | |
echo "" >> $DIR_HTML/README.md | |
echo "Last update of sphinx html documentation from [$SHORT_SHA](https://github.com/$GITHUB_REPOSITORY/tree/$SHA)" >> $DIR_HTML/README.md | |
cat $DIR_HTML/README.md | |
echo ::endgroup:: | |
echo ::group::Create .nojekyll in case 'sphinx.ext.githubpages' is not used | |
touch $DIR_HTML/.nojekyll | |
echo ::endgroup:: | |
echo ::group::Push to gh-pages | |
git add -f $DIR_HTML | |
git commit -m "From $GITHUB_REF $SHA" | |
git push origin `git subtree split --prefix $DIR_HTML ${{ inputs.branch }}`:gh-pages --force | |
echo ::endgroup:: |