tstor/.github/workflows/mkdocs.yml
dependabot[bot] 0a72125f14
Bump actions/checkout from 2 to 3 (#124)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-07 11:28:29 +01:00

76 lines
2.6 KiB
YAML

name: mkdocs
on:
push:
branches:
- master
tags:
- 'v*'
jobs:
mkdocs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# git-revision-date-localized-plugin and mkdocs-rss-plugin need full git history depth
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2.3.2
with:
python-version: "3.x"
- uses: actions/cache@v2.1.7
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
working-directory: ./mkdocs
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements.txt
- name: Build docs
working-directory: ./mkdocs
run: |
mkdocs build
# - name: Validate generated HTML files
# working-directory: ./mkdocs
# run: |
# docker run -v $(pwd):/test --rm wjdp/htmltest --conf .htmltest.yml
# 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 }}
- name: Deploy docs (Master)
if: github.ref == 'refs/heads/master'
working-directory: ./mkdocs
run: |
echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/mkdocs/docs/CNAME"
echo -e "User-agent: *\nDisallow: /v*.*/\nSitemap: https://${CUSTOM_DOMAIN}/sitemap.xml" > "${GITHUB_WORKSPACE}/mkdocs/docs/robots.txt"
git fetch origin gh-pages --verbose
mike deploy master dev --config-file "${GITHUB_WORKSPACE}/mkdocs/mkdocs.yml" --push --rebase
env:
CUSTOM_DOMAIN: distribyted.com
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
- name: Deploy docs (Versions)
env:
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
if: startsWith(github.ref, 'refs/tags/v')
run: |
git fetch origin gh-pages --verbose
mike deploy ${GITHUB_REF##*/} latest --config-file "${GITHUB_WORKSPACE}/mkdocs/mkdocs.yml" --push --rebase --update-aliases