diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 0675908..5768570 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -11,6 +11,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Build with MkDocs - uses: moonpathbg/mkdocs_builder@latest # https://github.com/moonpathbg/mkdocs_builder - #uses: romw314/mkdocs-action@v2 # https://github.com/marketplace/actions/mkdocs-build +# - name: Build with MkDocs +# uses: moonpathbg/mkdocs_builder@latest # https://github.com/moonpathbg/mkdocs_builder +# #uses: romw314/mkdocs-action@v2 # https://github.com/marketplace/actions/mkdocs-build + - name: Mkdocs build + uses: ./mkdocs-build-action/ # Uses an action in the root directory + id: build diff --git a/mkdocs-build-action/Dockerfile b/mkdocs-build-action/Dockerfile new file mode 100644 index 0000000..fd3dbd1 --- /dev/null +++ b/mkdocs-build-action/Dockerfile @@ -0,0 +1,9 @@ +FROM python:latest + +RUN python3 -m pip install mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-swan mkdocs-helm mkdocs-licenseinfo mkdocs-multilang mkdocs-autozip + +COPY entrypoint.sh /entrypoint.sh + +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/mkdocs-build-action/action.yml b/mkdocs-build-action/action.yml new file mode 100644 index 0000000..7c8fab2 --- /dev/null +++ b/mkdocs-build-action/action.yml @@ -0,0 +1,25 @@ +name: 'MkDocs Build' +description: 'Build your MkDocs projects' +inputs: + config-file: + description: 'The path to the MkDocs configuration file' + required: false + default: 'mkdocs.yml' + output-dir: + description: 'The directory to output the HTML site to, relative to workdir (see below)' + required: false + default: '_site' + workdir: + description: 'The root directory of your project (which contains the `docs` dir)' + required: false + default: '.' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.config-file }} + - ${{ inputs.output-dir }} + - ${{ inputs.workdir }} +branding: + icon: 'book' + color: 'blue' diff --git a/mkdocs-build-action/entrypoint.sh b/mkdocs-build-action/entrypoint.sh new file mode 100644 index 0000000..37945b4 --- /dev/null +++ b/mkdocs-build-action/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -eux + +cd "$3" + +if test -d .git; then + git config --global --add safe.directory "$(realpath "$3")" +fi + +mkdocs build --config-file "$1" --site-dir "$2"