blob: 6f9a238147a25131d0298abb040e4c1066384d37 [file] [log] [blame]
# 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/**"
defaults:
run:
working-directory: docs/website
jobs:
publish_website:
# Don't run this in everyone's forks.
if: github.repository == 'iree-org/iree'
runs-on: ubuntu-18.04
steps:
- name: Checkout out repository
uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2
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@7f80679172b057fc5e90d70d197929d454754a5a # v2
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
run: mkdocs gh-deploy