mirror of
https://codeberg.org/Codeberg-CI/examples.git
synced 2025-09-08 19:35:00 -04:00

like https://codeberg.org/Codeberg-CI/examples/pulls/59 It addresses deprecation's upcoming in v2.8.0 now Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/60
52 lines
1.7 KiB
YAML
52 lines
1.7 KiB
YAML
# build pdoc documentation into /public
|
|
# push content of /public to EXISTING pages branch
|
|
|
|
when:
|
|
branch: main
|
|
event: push
|
|
|
|
clone:
|
|
git:
|
|
image: woodpeckerci/plugin-git
|
|
settings:
|
|
recursive: true
|
|
|
|
steps:
|
|
build:
|
|
image: python:3.9-buster
|
|
commands:
|
|
- python -m venv venv
|
|
- /bin/bash -c "source venv/bin/activate"
|
|
- python -m pip install --upgrade pip
|
|
# install requirements from your source code (needed by pdoc)
|
|
- python -m pip install --upgrade -r requirements.txt
|
|
- python -m pip install pdoc
|
|
# locate the part of your code to be documented
|
|
- pdoc <my_python_module_or_file> -o public # test locally
|
|
|
|
publish:
|
|
image: bitnami/git:2
|
|
environment:
|
|
# secrets must be set in Woodpecker configuration
|
|
CBTOKEN:
|
|
from_secret: cbtoken
|
|
commands:
|
|
# config git to commit and push changes
|
|
- git config --global --add safe.directory $CI_WORKSPACE/public
|
|
- git config --global user.email "woodpecker-bot@no-reply.eu"
|
|
- git config --global user.name "woodpecker-bot"
|
|
- git config --global init.defaultBranch pages
|
|
# clone the existing pages branch which will be updated with new pdoc build
|
|
- git clone -b pages https://$CBTOKEN@codeberg.org/<user_name>/<repo_name>.git build_pdocs
|
|
# purge existing docs
|
|
- rm -rf build_pdocs/*
|
|
# add new docs
|
|
- cp -a public/* build_pdocs/
|
|
# commit and push to pages branch
|
|
- cd build_pdocs/
|
|
- git remote set-url origin https://$CBTOKEN@codeberg.org/<user_name>/<repo_name>.git
|
|
- git add --all
|
|
# exclude current push from CI pipeline triggering
|
|
- git commit -m "deploy $CI_COMMIT_SHA [CI SKIP]"
|
|
- git push -u origin pages
|