tstor/.github/workflows/mkdocs.yml
Antonio Navarro Perez 5f95dd93b1
Update mkdocs.yml
2021-10-07 19:45:02 +02:00

73 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@v2
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.2.2
with:
python-version: "3.x"
- uses: actions/cache@v2.1.6
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
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/v')
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 (Latest)
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 delete dev
mike deploy dev -t "master" --config-file "${GITHUB_WORKSPACE}/mkdocs/mkdocs.yml" --push --rebase
env:
CUSTOM_DOMAIN: distribyted.com
- name: Deploy docs (Self-hosted)
if: startsWith(github.ref, 'refs/heads/release/v')
run: |
git fetch origin gh-pages --verbose
mike deploy ${GITHUB_REF##*/release/} -t "Self-hosted ${GITHUB_REF##*/release/}" --config-file "${GITHUB_WORKSPACE}/mkdocs/mkdocs.yml" --push --rebase