GitHub Actions for doc (#12353)

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2020-11-25 23:18:02 +01:00
committed by GitHub
parent 927fac6ca7
commit d8c617d2ae
3 changed files with 69 additions and 1 deletions

50
.github/workflows/doc.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: doc
on:
push:
branches:
- 'master'
paths:
- '.github/workflows/doc.yml'
- 'doc/**'
- 'mkdocs.yml'
pull_request:
branches:
- 'master'
paths:
- '.github/workflows/doc.yml'
- 'doc/**'
- 'mkdocs.yml'
jobs:
publish:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Build mkdocs Docker image
run: |
docker build -t mkdocs -f ./doc/Dockerfile ./
-
name: Build docs
run: |
docker run --rm -v "$(pwd):/docs" mkdocs build --strict
sudo chown -R $(id -u):$(id -g) ./out
-
name: Check GitHub Pages status
uses: crazy-max/ghaction-github-status@v2
with:
pages_threshold: major_outage
-
name: Deploy
if: github.event_name != 'pull_request' && endsWith(github.ref, github.event.repository.default_branch)
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: out
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

16
doc/Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM squidfunk/mkdocs-material:6.1.0
RUN \
apk add --no-cache \
git \
git-fast-import \
openssh \
&& apk add --no-cache --virtual .build gcc musl-dev \
&& pip install --no-cache-dir \
'markdown-include' \
'mkdocs-awesome-pages-plugin' \
'mkdocs-exclude' \
'mkdocs-git-revision-date-localized-plugin' \
'mkdocs-macros-plugin' \
&& apk del .build gcc musl-dev \
&& rm -rf /tmp/*

View File

@@ -29,7 +29,9 @@ plugins:
j2_variable_end_string: '=@'
- search
- exclude:
glob: General/Changelogs/*
glob:
- "General/Changelogs/*"
- "Dockerfile"
extra_css:
- https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css
- librenms.css