From 95983cbebc7251b610f11d2228ba1064978ede88 Mon Sep 17 00:00:00 2001 From: polarathene <5098581+polarathene@users.noreply.github.com> Date: Mon, 1 Mar 2021 01:14:12 +1300 Subject: [PATCH] docs(ci): Add workflow to build and deploy docs Separate workflows for `push` and `pull_request` events. This avoids a `skipped` job status (`Check Run`?) always being presented for the `deploy` job in Pull Requests. --- chore(`.gitignore`): Ignore the `docs/site/` build output Ignore to avoid local builds output appearing in git as unstaged. --- .github/workflows/deploy-docs.yml | 33 +++++++++++++++++++++++++++++++ .github/workflows/pr-docs.yml | 22 +++++++++++++++++++++ .gitignore | 2 ++ 3 files changed, 57 insertions(+) create mode 100644 .github/workflows/deploy-docs.yml create mode 100644 .github/workflows/pr-docs.yml diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 00000000..8aeba50a --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,33 @@ +name: 'Documentation' + +on: + workflow_dispatch: + push: + branches: + - master + paths: + - '.github/workflows/deploy-docs.yml' + - 'docs/**' + +# Jobs will run shell commands from this subdirectory: +defaults: + run: + working-directory: docs + +jobs: + deploy: + name: 'Deploy Docs' + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: 'Build with mkdocs-material via Docker' + run: docker run --rm -v ${PWD}:/docs squidfunk/mkdocs-material build --strict + + - name: 'Deploy to Github Pages' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/site + user_name: 'github-actions[bot]' + user_email: '41898282+github-actions[bot]@users.noreply.github.com' diff --git a/.github/workflows/pr-docs.yml b/.github/workflows/pr-docs.yml new file mode 100644 index 00000000..d0f1d030 --- /dev/null +++ b/.github/workflows/pr-docs.yml @@ -0,0 +1,22 @@ +name: 'Documentation' + +on: + pull_request: + paths: + - '.github/workflows/pr-docs.yml' + - 'docs/**' + +# Jobs will run shell commands from this subdirectory: +defaults: + run: + working-directory: docs + +jobs: + build: + name: 'Verify Build' + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: 'Build with mkdocs-material via Docker' + run: docker run --rm -v ${PWD}:/docs squidfunk/mkdocs-material build --strict diff --git a/.gitignore b/.gitignore index 71cc9fed..0b897101 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,5 @@ test/duplicate_configs config.bak testconfig.bak + +docs/site