forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 11
77 lines (74 loc) · 3.14 KB
/
publish_website.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# 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/scripts/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]
jobs:
publish_website:
# Note: a clean build of `iree-tblgen` takes ~5 minutes on standard runners.
runs-on: ubuntu-20.04
steps:
- name: Checkout out repository
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
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@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: 3.x
cache: 'pip'
- id: "gcp-auth"
name: "Authenticating to Google Cloud"
uses: "google-github-actions/auth@v1"
with:
token_format: "access_token"
credentials_json: "${{ secrets.IREE_OSS_GITHUB_RUNNER_BASIC_TRUST_SERVICE_ACCOUNT_KEY }}"
create_credentials_file: false
- name: Installing dependencies
run: |
pip install -r docs/website/requirements.txt
pip install 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: Building documentation files
run: |
./build_tools/github_actions/docker_run.sh \
--env "IREE_CCACHE_GCP_TOKEN=${{ steps.gcp-auth.outputs.access_token }}" \
--env "IREE_WRITE_REMOTE_CCACHE=1" \
--env "CCACHE_NAMESPACE=gcr.io/iree-oss/base@sha256:796fb81a11ff7e7d057c93de468b74e48b6a9641aa19b7f7673c2772e8ea3b33" \
gcr.io/iree-oss/base@sha256:796fb81a11ff7e7d057c93de468b74e48b6a9641aa19b7f7673c2772e8ea3b33 \
./docs/website/generate_extra_files.sh
- name: Setting git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "Website Publish Action"
- name: Deploying to gh-pages
working-directory: docs/website
run: mkdocs gh-deploy