You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This discussion is meant as a way to collect possible setups to automatically publish MkDocs Pages to any Static Site Host (SSH) that might exist out there such as GitHub Pages, GitLab Pages, Codeberg Pages (Bunch of "... Pages" Services), etc.
Maybe, this can be used in the future to update the user docs of MkDocs with up-to-date examples of deploying your documentation.
If you share your own setups, try to avoid duplicates and also stick to posting the info (i.e. file setups) directly here, instead of linking to a post.
GitHub Actions (Publish to GH Pages)
Note
Uses and requires a requirements.txt file with the dependencies in it.
Custom domains need to be specified in the Pages settings of your repository, not in a CNAME file.
name: Publish siteon:
workflow_dispatch:
push:
branches:
- master
- main#paths: # Recommended to avoid extra builds# - .github/workflows/your_site_publish_file.yml # Change name to what your workflow file is# - docs/**# - mkdocs.yml# - requirements.txtpermissions:
contents: readpages: writeid-token: writeconcurrency:
group: github-pagescancel-in-progress: falsejobs:
buildAndPublish:
runs-on: ubuntu-latestenvironment:
name: github-pagesurl: ${{ steps.deployment.outputs.page_url }}steps:
- name: Checkout Repositoryuses: actions/checkout@v4with:
fetch-depth: 0# Recommended for git localized plugin
- name: Setup Python 3.xuses: actions/setup-python@v5with:
python-version: 3.x
- name: Install dependenciesrun: | python -m pip install -U pip setuptools python -m pip install -r requirements.txt # Define your dependencies in this file.
- name: Build Pagesrun: mkdocs build
- name: Configure GitHub Pages # No idea if that actually does anything...uses: actions/configure-pages@v4
- name: Upload Pages Artifactuses: actions/upload-pages-artifact@v2with:
path: site/ # Important. Set to your output dir in MkDocs
- name: Deploy to GitHub Pagesid: deploymentuses: actions/deploy-pages@v3
Woodpecker-CI (Publish to Codeberg Pages)
Note
Uses and requires a requirements.txt file with the dependencies in it.
This setup also requires a target repository with a pages branch to commit to and a PAT for authentication during push.
Folders and files persist between steps.
when:
- event: pushbranch: master # Change to your branch with MkDocspath:
include: ["docs/**", "mkdocs.yml", "requirements.txt"]# Reusablesvariables:
setup_git: &setup_git
- apk add git
- git config user.email "$EMAIL" # Provided as secret later on
- git config user.name "CI Site Builder"steps:
cloneTargetRepo:
image: alpine:3.18.4 # Can be any image offering chmod, mv, cd, etc.secrets: [email]commands:
- chmod -R a+w . # Avoid possible permission issues
- <<: *setup_git # Insert our Git reusable
- git config --add safe.directory /woodpecker/src/codeberg.org/ExampleUser/ExampleRepo # Change to whatever path the source repo was cloned into
- git config init.defaultBranch pages
- git clone -b pages https://codeberg.org/ExampleUser/TargetRepo.git pages # Your target repo for the page
- chmod -R a+w pagesbuildDocs:
image: woodpeckerci/plugin-mkdocs:latest # Recommended to stay on latest release. Uses Material for MkDocs as basesettings:
site_dir: pages # Override MkDocs site_dir outputcommitAndPush:
image: alpine:3.18.4secrets: [email, cbtoken] # cbtoken is a PAT with push perms to the target repocommands:
- <<: *setup_git
- mv domains .domains # Optional. Moves a domains file containing your custom domain into the pages folder and names it .domains for Codeberg Pages to recognize
- cd pages
- git remote set-url origin https://$CBTOKEN@codeberg.org/ExampleUser/TargetRepo.git
- git add --all
- git commit -m "Update Site ($( env date +"%d.%m.%Y %Z" )) [SKIP CI]"
- git push
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This discussion is meant as a way to collect possible setups to automatically publish MkDocs Pages to any Static Site Host (SSH) that might exist out there such as GitHub Pages, GitLab Pages, Codeberg Pages (Bunch of "... Pages" Services), etc.
Maybe, this can be used in the future to update the user docs of MkDocs with up-to-date examples of deploying your documentation.
If you share your own setups, try to avoid duplicates and also stick to posting the info (i.e. file setups) directly here, instead of linking to a post.
GitHub Actions (Publish to GH Pages)
Note
requirements.txt
file with the dependencies in it.CNAME
file.Woodpecker-CI (Publish to Codeberg Pages)
Note
requirements.txt
file with the dependencies in it.pages
branch to commit to and a PAT for authentication during push.Beta Was this translation helpful? Give feedback.
All reactions