2021-10-07 17:27:19 +00:00
|
|
|
name: mkdocs
|
2021-10-07 17:03:03 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
mkdocs:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2022-03-07 10:28:29 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-10-07 17:03:03 +00:00
|
|
|
with:
|
|
|
|
# git-revision-date-localized-plugin and mkdocs-rss-plugin need full git history depth
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Python
|
2022-10-10 09:07:51 +00:00
|
|
|
uses: actions/setup-python@v4
|
2021-10-07 17:03:03 +00:00
|
|
|
with:
|
|
|
|
python-version: "3.x"
|
|
|
|
|
2023-03-07 07:08:31 +00:00
|
|
|
- uses: actions/cache@v3.2.6
|
2021-10-07 17:03:03 +00:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pip-
|
2021-10-07 17:05:55 +00:00
|
|
|
- name: Install dependencies
|
2021-10-07 17:10:46 +00:00
|
|
|
working-directory: ./mkdocs
|
2021-10-07 17:03:03 +00:00
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip setuptools wheel
|
|
|
|
python -m pip install -r requirements.txt
|
|
|
|
- name: Build docs
|
2021-10-07 17:10:46 +00:00
|
|
|
working-directory: ./mkdocs
|
2021-10-07 17:03:03 +00:00
|
|
|
run: |
|
|
|
|
mkdocs build
|
2021-10-07 17:27:19 +00:00
|
|
|
# - name: Validate generated HTML files
|
|
|
|
# working-directory: ./mkdocs
|
|
|
|
# run: |
|
|
|
|
# docker run -v $(pwd):/test --rm wjdp/htmltest --conf .htmltest.yml
|
2021-10-07 17:03:03 +00:00
|
|
|
# On push to master or release branch, deploy docs
|
|
|
|
- name: Set up git author
|
|
|
|
run: |
|
|
|
|
remote_repo="https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
|
|
|
git config --global user.name "${GITHUB_ACTOR}"
|
|
|
|
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
|
|
git remote rm origin
|
|
|
|
git remote add origin "${remote_repo}"
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2021-10-07 18:09:33 +00:00
|
|
|
- name: Deploy docs (Master)
|
2021-10-07 17:03:03 +00:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-10-07 17:36:25 +00:00
|
|
|
working-directory: ./mkdocs
|
2021-10-07 17:03:03 +00:00
|
|
|
run: |
|
|
|
|
echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/mkdocs/docs/CNAME"
|
2021-10-07 17:31:26 +00:00
|
|
|
echo -e "User-agent: *\nDisallow: /v*.*/\nSitemap: https://${CUSTOM_DOMAIN}/sitemap.xml" > "${GITHUB_WORKSPACE}/mkdocs/docs/robots.txt"
|
2021-10-07 17:03:03 +00:00
|
|
|
git fetch origin gh-pages --verbose
|
2021-10-07 17:52:47 +00:00
|
|
|
mike deploy master dev --config-file "${GITHUB_WORKSPACE}/mkdocs/mkdocs.yml" --push --rebase
|
2021-10-07 17:03:03 +00:00
|
|
|
env:
|
2021-10-07 17:36:25 +00:00
|
|
|
CUSTOM_DOMAIN: distribyted.com
|
2021-11-29 10:53:37 +00:00
|
|
|
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
|
2021-10-07 17:03:03 +00:00
|
|
|
|
2021-10-07 18:09:33 +00:00
|
|
|
- name: Deploy docs (Versions)
|
2021-11-29 10:53:37 +00:00
|
|
|
env:
|
|
|
|
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
|
|
|
|
|
2021-10-08 10:00:56 +00:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2021-10-07 17:03:03 +00:00
|
|
|
run: |
|
|
|
|
git fetch origin gh-pages --verbose
|
2021-11-16 12:40:14 +00:00
|
|
|
mike deploy ${GITHUB_REF##*/} latest --config-file "${GITHUB_WORKSPACE}/mkdocs/mkdocs.yml" --push --rebase --update-aliases
|
2021-10-08 10:15:49 +00:00
|
|
|
|