Add support of holes to contours generation (#335) #72
This file contains hidden or 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: Build Docs | |
permissions: {} # No permissions by default on workflow level | |
on: | |
workflow_dispatch: # run on request (no need for PR) | |
push: | |
branches: | |
- master | |
jobs: | |
Build-Docs: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: pip install 'src/python/.[docs]' | |
- name: Install and Generate Doxygen | |
uses: mattnotmitt/doxygen-action@b84fe17600245bb5db3d6c247cc274ea98c15a3b # v1.12.0 | |
- name: Build Docs | |
run: | | |
cd docs | |
make html | |
- name: Branch name | |
id: branch_name | |
shell: bash | |
run: | | |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} | |
- name: Create gh-pages branch | |
env: | |
SOURCE: ${{steps.branch_name.outputs.SOURCE_NAME}} | |
run: | | |
if [[ ${{github.event_name}} == 'workflow_dispatch' ]]; then | |
echo RELEASE_VERSION="test_build" >> $GITHUB_ENV | |
else | |
echo RELEASE_VERSION=${GITHUB_REF#refs/*/} >> $GITHUB_ENV | |
fi | |
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 "[email protected]" | |
git config --local user.name "GitHub Action" | |
git checkout --orphan gh-pages | |
git reset --hard | |
echo '<html><head><meta http-equiv="refresh" content="0; url=latest/" /></head></html>' > index.html | |
git add index.html | |
touch .nojekyll | |
git add .nojekyll | |
git commit -m "Initializing gh-pages branch" | |
git push origin gh-pages | |
git checkout "${SOURCE}" | |
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=latest/" /></head></html>' > index.html | |
mkdir -p ${{ env.RELEASE_VERSION }} | |
cp -r /tmp/docs_build/* ./${{ env.RELEASE_VERSION }} | |
rm -rf /tmp/docs_build | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
if [[ ${{ env.RELEASE_VERSION }} != 'test_build' ]]; then | |
ln -sfn ${{ env.RELEASE_VERSION }} latest | |
fi | |
git add ./latest ${{ env.RELEASE_VERSION }} | |
git add index.html | |
git commit -m "Update documentation" -a || true | |
- name: Push changes | |
uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages |