From d8c617d2aea8bd81437fccf177d7fe134d1dcb5b Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 25 Nov 2020 23:18:02 +0100 Subject: [PATCH] GitHub Actions for doc (#12353) Co-authored-by: CrazyMax --- .github/workflows/doc.yml | 50 +++++++++++++++++++++++++++++++++++++++ doc/Dockerfile | 16 +++++++++++++ mkdocs.yml | 4 +++- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/doc.yml create mode 100644 doc/Dockerfile diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 0000000000..f73119895f --- /dev/null +++ b/.github/workflows/doc.yml @@ -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 }} diff --git a/doc/Dockerfile b/doc/Dockerfile new file mode 100644 index 0000000000..3a25fc021e --- /dev/null +++ b/doc/Dockerfile @@ -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/* diff --git a/mkdocs.yml b/mkdocs.yml index 53a8827386..b1985a5c13 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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