| # 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: | |
| # This file itself. | |
| - ".github/workflows/publish_website.yml" | |
| # Directly authored website source files. | |
| - "docs/website/**" | |
| # Python/pip release index page. | |
| - "build_tools/python_deploy/generate_release_index.py" | |
| # MLIR dialect definitions and .md generation using iree-tblgen. | |
| # Technically this should also include the sources for Tablegen, but | |
| # that rarely changes and we want to run this workflow conservatively. | |
| - "**.td" | |
| - "build_tools/cmake/iree_tablegen_doc.cmake" | |
| # Regenerate the release pip index when a release is created or deleted. | |
| release: | |
| types: [published, unpublished] | |
| # Run periodically to pick up any documentation changes that were somehow | |
| # missed by the above path filters as well as to scrape releases from other | |
| # projects that are included on the release index page. Downstream projects | |
| # typically build releases in the middle of the night (3AM PST, 11:00 UTC), | |
| # so we'll run a bit later than that (6AM PST, 14:00 UTC). | |
| schedule: | |
| - cron: "0 14 * * *" | |
| jobs: | |
| publish_website: | |
| if: ${{ github.repository_owner == 'iree-org' || github.event_name == 'workflow_dispatch' }} | |
| # Note: a clean build of `iree-tblgen` takes ~5 minutes on standard runners. | |
| runs-on: ubuntu-24.04 | |
| env: | |
| CC: clang | |
| CXX: clang++ | |
| steps: | |
| - name: Checkout out repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| submodules: true | |
| 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@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: 3.x | |
| cache: "pip" | |
| - name: Installing dependencies | |
| run: | | |
| pip install -r docs/website/requirements.txt | |
| pip install requests | |
| sudo apt update | |
| sudo apt install -y ninja-build | |
| # Build a release index page by scraping release package URLs. | |
| # | |
| # This can scrape the release pages from any public GitHub repositories. | |
| # Currently included repositories: | |
| # https://github.com/iree-org/iree | |
| # https://github.com/iree-org/iree-turbine | |
| # Ecosystem projects for consideration: | |
| # https://github.com/nod-ai/amd-shark-ai | |
| # https://github.com/openxla/stablehlo | |
| # https://github.com/llvm/torch-mlir (see below) | |
| # https://github.com/llvm/torch-mlir-release | |
| - name: Generating release index | |
| run: | | |
| ./build_tools/python_deploy/generate_release_index.py \ | |
| --repos="iree-org/iree,iree-org/iree-turbine" \ | |
| --output=docs/website/docs/pip-release-links.html | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 | |
| with: | |
| key: ${{ github.job }} | |
| - name: Building documentation files | |
| run: ./docs/website/generate_extra_files.sh | |
| # Release candidate releases (tags like `iree-3.6.0rc20250910`) are | |
| # published automatically by the candidate release workflows. Deploying | |
| # the website from them would overwrite the site last published from | |
| # main, so for those runs everything above only serves to verify that | |
| # the website still builds and the deployment steps are skipped. | |
| - name: Skipping deployment (release candidate) | |
| if: ${{ github.event_name == 'release' && contains(github.event.release.tag_name, 'rc') }} | |
| run: | | |
| echo "Triggered by a release candidate release; skipping deploy to gh-pages." | |
| - name: Setting git config | |
| if: ${{ github.event_name != 'release' || !contains(github.event.release.tag_name, 'rc') }} | |
| 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 | |
| if: ${{ github.event_name != 'release' || !contains(github.event.release.tag_name, 'rc') }} | |
| working-directory: docs/website | |
| run: mkdocs gh-deploy |