| # Builds the website sourced from docs/website/ using `mkdocs` and pushes |
| # to the gh-pages branch for publishing on GitHub Pages. |
| # |
| # See https://squidfunk.github.io/mkdocs-material/publishing-your-site/ |
| |
| name: Publish Website |
| |
| on: |
| workflow_dispatch: |
| push: |
| branches: |
| - main |
| paths: |
| - "docs/website/**" |
| - "build_tools/scripts/generate_release_index.py" |
| - ".github/workflows/publish_website.yml" |
| # Regenerate the release pip index when a regular or pre-release is created or |
| # deleted. |
| release: |
| types: [published, unpublished] |
| |
| jobs: |
| publish_website: |
| runs-on: ubuntu-20.04 |
| steps: |
| - name: Checkout out repository |
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
| with: |
| token: ${{ secrets.WRITE_ACCESS_TOKEN }} |
| - name: Fetching base gh-pages branch |
| # We have to explicitly fetch the gh-pages branch as well to preserve history |
| run: git fetch --no-tags --prune --depth=1 origin "gh-pages:gh-pages" |
| - name: Setting up Python |
| uses: actions/setup-python@75f3110429a8c05be0e1bf360334e4cced2b63fa # v2.3.3 |
| with: |
| python-version: 3.x |
| cache: 'pip' |
| - name: Installing dependencies |
| run: | |
| pip install \ |
| mkdocs-material \ |
| requests |
| - name: Generating release index |
| run: | |
| ./build_tools/scripts/generate_release_index.py \ |
| --repo="${GITHUB_REPOSITORY}" \ |
| --output=docs/website/docs/pip-release-links.html |
| - name: Setting git config |
| run: | |
| git config --local user.email "iree-github-actions-bot@google.com" |
| git config --local user.name "Website Publish Action" |
| - name: Deploying to gh-pages |
| working-directory: docs/website |
| run: mkdocs gh-deploy |