Add example to build and deploy mkdocs to codeberg pages (#24)

An example of pipeline which builds and deploys an `mkdocs` site to codeberg pages.

This is tested and works in https://codeberg.org/openfindata/openfindata.

Co-authored-by: Laurent Savaëte <laurent@where.tf>
Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/24
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: laurents <laurents@noreply.codeberg.org>
Co-committed-by: laurents <laurents@noreply.codeberg.org>
This commit is contained in:
laurents 2023-03-14 16:28:20 +00:00 committed by 6543
parent 3dfb0b7226
commit 562fafda11

28
Python/mkdocs.yml Normal file
View File

@ -0,0 +1,28 @@
# build and deploy mkdocs to codeberg pages
# This assumes your code lives in one repo, and you have a <owner>/pages
# repo which will be used to host the built pages.
pipeline:
build-docs:
# build the docs in /docs with mkdocs and
# add the .domains file for codeberg pages
image: squidfunk/mkdocs-material
commands:
- mkdocs build -f ./mkdocs.yml -d docs_build
- git switch --orphan pages
- mv docs_build/* .
- echo -e '<yourtld.com>\n<codeberg_username>.codeberg.page\npages.<codeberg_username>.codeberg.page' > .domains
deploy-docs:
# Push the resulting files to openfindata/pages
# to deploy
image: appleboy/drone-git-push
settings:
branch: main
remote: git@codeberg.org:<codeberg_org>/pages.git
force: true
commit: true
ssh_key:
# created using woodpecker cli with:
# woodpecker secret add -repository <org>/<repo> \
# -name codeberg_push_from_ci_priv_key -value @<path_to_privkey_file>
from_secret: codeberg_push_from_ci_priv_key