Add mdbook (#29)

An example to publish pages built with mdbook on Codeberg Pages.

Co-authored-by: Tealk <tealk@rollenspiel.monster>
Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/29
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Tealk <tealk@noreply.codeberg.org>
Co-committed-by: Tealk <tealk@noreply.codeberg.org>
This commit is contained in:
Tealk 2023-06-10 11:50:43 +00:00 committed by 6543
parent 5444d19d75
commit ca469fd9dc
3 changed files with 44 additions and 0 deletions

View File

@ -18,3 +18,4 @@ steps:
- woodpecker-cli lint tectonic/
- woodpecker-cli lint NodeJS/11ty.yml
- woodpecker-cli lint KiCad/kibot.yml
- woodpecker-cli lint mdbook/*.yml

View File

@ -23,6 +23,7 @@ Pull requests are accepted/welcome.
| [tectonic/.woodpecker.yml](tectonic/.woodpecker.yml) | LaTeX | Tectonic | Builds a TeX file and pushes the resulting PDF file to a given repository. |
| [NodeJS/11ty.yml](NodeJS/11ty.yml) | JavaScript | NodeJS | CI to build static websites files and publish them to Codeberg Pages with 11ty |
| [KiCad/kibot.yml](KiCad/kibot.yml) | --- | KiBot | Building gerber files, ibom and a pdf schematic as an example for KiBot use |
| [mdbook/mdbook.yml](mdbook/mdbook.yml) | Markdown | mdbook | CI step to build static website files and publish them to Codeberg Pages with mdbook |
# More:

42
mdbook/mdbook.yml Normal file
View File

@ -0,0 +1,42 @@
# hugo.yml
#
# Takes a repository with mdbook source, generates the static site and
# pushes the result to Codeberg pages
#
# Needs a codeberg access token (codeberg_token) as a secret in Woodpecker config
# Also uses another secret (mail) with email address for git config
#
# .domains file in the repository is copied to the output branch so custom domains work
#
# The MDBOOK_OUTPUT variable must be set to the build output folder configured in Hugo
#
clone:
git:
image: woodpeckerci/plugin-git
when:
branch: master
event: [ push, cron ]
steps:
build:
image: peaceiris/mdbook:latest
commands:
- mdbook build
publish:
image: bitnami/git
secrets: [ mail, codeberg_token ]
environment:
- MDBOOK_OUTPUT=book
commands:
- git config --global user.email $MAIL
- git config --global user.name "Woodpecker CI"
- git clone -b pages https://$CODEBERG_TOKEN@codeberg.org/$CI_REPO.git $CI_REPO_NAME
- cp -ar $MDBOOK_OUTPUT/. $CI_REPO_NAME/
- cp .domains $CI_REPO_NAME || true
- cd $CI_REPO_NAME
- git add .
- git commit -m "Woodpecker CI ${CI_BUILD_CREATED}"
- git push