Generate documentation html pages #27
Workflow file for this run
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: Build FarmVibes.AI documentation | |
run-name: Generate documentation html pages | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
if_merged: | |
if: github.event.pull_request.merged == true || contains(fromJSON('["workflow_dispatch"]'), github.event_name) | |
name: Build documentation | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Update pip version | |
shell: bash | |
run: pip install --upgrade pip | |
### Build docs with sphinx | |
- name: Build documentation pages | |
uses: ammaraskar/sphinx-action@master | |
with: | |
docs-folder: "docs/" | |
pre-build-command: "pip install --user ./src/vibe_core" | |
# Publish built docs to gh-pages branch | |
- name: Publish to gh-pages | |
run: | | |
git clone https://github.com/microsoft/farmvibes-ai.git --branch gh-pages --single-branch gh-pages | |
cp -r docs/build/html/* gh-pages/ | |
cd gh-pages | |
touch .nojekyll | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "Update documentation" -a || true | |
# The above command will fail if no changes were present, so we ignore that. | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
directory: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} |