add gh-action to deploy mkdocs to gh-pages (#3557)

* add gh-action to deploy mkdocs to gh-pages

* update commit user for gh-pages

Signed-off-by: Carlos Santana <csantana23@gmail.com>

* switch to fast livereload

Signed-off-by: Carlos Santana <csantana23@gmail.com>
This commit is contained in:
Carlos Santana 2021-05-12 16:09:47 -04:00 committed by GitHub
parent d6e12b982d
commit 5e9b4024ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 83 additions and 0 deletions

31
.github/workflows/knative-mkdocs.yaml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Publish MkDocs
on:
push:
branches: [ mkdocs ]
jobs:
mkdocs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install dependencies
run: |
pip install mkdocs mkdocs-macros-plugin mkdocs-exclude mike
- name: Setup doc deploy
run: |
git config --global user.name "Knative Automation"
git config --global user.email automation@knative.team
- name: Build docs
run: |
mike deploy dev --push

2
hack/docker/Dockerfile Normal file
View File

@ -0,0 +1,2 @@
FROM squidfunk/mkdocs-material
RUN pip install --no-cache-dir mkdocs-macros-plugin mkdocs-exclude mike

19
hack/docker/README.md Normal file
View File

@ -0,0 +1,19 @@
# Development notes for working with mkdocs
## Container
Build the container image
```bash
./hack/docker/build.sh
```
Run the livereload site
```bash
./hack/docker/run.sh
```
Remove the container
```bash
./hack/docker/clean.sh
```

8
hack/docker/build.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
IMAGE=${1:-mkdocs}
SCRIPT_DIR=$(cd $(dirname $0); pwd -P)
ROOT_DIR=$(cd "${SCRIPT_DIR}/.."; pwd -P)
docker build -t ${IMAGE} ${SCRIPT_DIR}

8
hack/docker/clean.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
NAME=${1:-mkdocs}
echo "Cleaning up old container '${NAME}'..."
docker rm "${NAME}" --force 1> /dev/null 2> /dev/null
echo "Finished clean up"

5
hack/docker/mkdocs.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
PORT=${2:-8000}
mkdocs serve --config-file "./mkdocs.yml" --livereload -a 0.0.0.0:${PORT}

10
hack/docker/run.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
NAME=${1:-mkdocs}
PORT=${2:-8000}
IMAGE=${3:-mkdocs}
docker run --name "${NAME}" -d -p "${PORT}:${PORT}" -v "${PWD}:/site" mkdocs serve -f /site/mkdocs.yml --dirtyreload -a "0.0.0.0:${PORT}"
echo "Dev environment running with live reloading enabled. Open http://localhost:${PORT} to see the site"
echo "For live logs run:"
echo "docker logs -f ${NAME}"