Merge pull request #251 from Readon/master #226
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: "Push RTD on gh-pages" | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
schedule: | |
# * is a special character in YAML | |
# setup monthly background build | |
- cron: '45 4 20 * *' | |
# gh-pages have a lifetime ? 90 days ? so we do this once a month to refresh | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
env: | |
sphinx_html_baseurl: 'https://spinalhdl.github.io/SpinalDoc-RTD/master/' | |
sphinx_github_url: 'https://github.com/SpinalHDL/SpinalDoc-RTD' | |
sphinx_extra_version: 'master' | |
if: github.event.head_commit.author.email != 'action.github.com' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
load: true | |
push: false | |
cache-to: type=gha | |
cache-from: type=gha | |
tags: spinaldoc-pdf | |
file: pdf.Dockerfile | |
- name: Check links | |
run: docker run --rm -u $(id -u $USER):$(id -g $USER) -v $PWD:/docs -e sphinx_html_baseurl -e sphinx_github_url spinaldoc-pdf make linkcheck | |
- name: Build zh-cn translated doc | |
run: docker run --rm -u $(id -u $USER):$(id -g $USER) -v $PWD:/docs -e sphinx_html_baseurl -e sphinx_github_url spinaldoc-pdf sphinx-build -b html -D language=zh_CN ./source/ docs/html/zh_CN | |
- name: Build multiversioned doc | |
run: docker run --rm -u $(id -u $USER):$(id -g $USER) -v $PWD:/docs -e sphinx_html_baseurl -e sphinx_github_url spinaldoc-pdf sphinx-multiversion source docs/html | |
- name: Add .nojekill | |
run: sudo touch docs/html/.nojekyll | |
- name: Add redirection to master | |
run: | | |
sudo tee docs/html/index.html << EOF | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Redirecting to ${sphinx_extra_version}</title> | |
<meta charset="utf-8"> | |
<meta http-equiv="refresh" content="0; url=./${sphinx_extra_version}/index.html"> | |
<link rel="canonical" href="${sphinx_html_baseurl}index.html"> | |
</head> | |
</html> | |
EOF | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: docs/html |