Spaces:
Build error
Build error
| name: Build Docs | |
| on: | |
| push: | |
| branches: [development] | |
| paths-ignore: | |
| - ".github/**" # Ignore changes towards the .github directory | |
| workflow_dispatch: # run on request (no need for PR) | |
| jobs: | |
| Build-and-Publish-Documentation: | |
| runs-on: [docs] | |
| steps: | |
| - name: CHECKOUT REPOSITORY | |
| uses: actions/checkout@v2 | |
| - name: Install requirements | |
| run: | | |
| pip install -r requirements/base.txt | |
| pip install -r requirements/dev.txt | |
| pip install -r requirements/openvino.txt | |
| - name: Build and Commit Docs | |
| run: | | |
| pip install -r requirements/docs.txt | |
| cd docs | |
| make html | |
| - name: Create gh-pages branch | |
| run: | | |
| echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} | |
| echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} | |
| echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | |
| 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 ./* | |
| cp -r /tmp/docs_build/* ./ | |
| rm -rf /tmp/docs_build | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add . | |
| 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 | |