Skip to content

Commit

Permalink
Install pandoc as dependency to docs-stable wf
Browse files Browse the repository at this point in the history
  • Loading branch information
yunchu committed Apr 18, 2023
1 parent 6f396d1 commit 76d66c4
Showing 1 changed file with 47 additions and 8 deletions.
55 changes: 47 additions & 8 deletions .github/workflows/docs_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,54 @@ jobs:
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install tox
run: |
python -m pip install tox
sudo apt-get install pandoc
- name: Build-Docs
run: |
echo RELEASE_VERSION=${GITHUB_REF#refs/*/} >> $GITHUB_ENV
tox -e build-docs
# - name: Deploy
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./public
# destination_dir: ${{ env.RELEASE_VERSION }}
# force_orphan: true
- name: Create gh-pages branch
run: |
echo RELEASE_VERSION=${GITHUB_REF#refs/*/} >> $GITHUB_ENV
echo SOURCE_NAME=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
echo SOURCE_BRANCH=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT
echo SOURCE_TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
existed_in_remote=$(git ls-remote --heads origin gh-pages)
if [[ -z ${existed_in_remote} ]]; then
echo "Creating gh-pages branch"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout --orphan gh-pages
git reset --hard
touch .nojekyll
git add .nojekyll
git commit -m "Initializing gh-pages branch"
git push origin gh-pages
git checkout ${{steps.branch_name.outputs.SOURCE_NAME}}
echo "Created gh-pages branch"
else
echo "Branch gh-pages already exists"
fi
- name: Commit docs to gh-pages branch
run: |
git fetch
git checkout gh-pages
mkdir -p /tmp/docs_build
cp -r docs/build/html/* /tmp/docs_build/
rm -rf ${{ env.RELEASE_VERSION }}/*
echo '<html><head><meta http-equiv="refresh" content="0; url=stable/" /></head></html>' > index.html
mkdir -p ${{ env.RELEASE_VERSION }}
cp -r /tmp/docs_build/* ./${{ env.RELEASE_VERSION }}
ln -sfn ${{ env.RELEASE_VERSION }} stable
rm -rf /tmp/docs_build
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add ./stable ${{ env.RELEASE_VERSION }}
git commit -m "Update documentation" -a || true
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages

0 comments on commit 76d66c4

Please sign in to comment.