Publish your site¶
The great thing about hosting project documentation in a git repository is
the ability to deploy it automatically when new changes are pushed. Zensical
makes this ridiculously simple.
GitHub Pages¶
If you're already hosting your code on GitHub, GitHub Pages is certainly the most convenient way to publish your project documentation. It's free of charge and pretty easy to set up.
with GitHub Actions¶
Using GitHub Actions you can automate the deployment of your project
documentation. At the root of your repository, create a new GitHub Actions
workflow, e.g. .github/workflows/docs.yml, and copy and paste the following
contents:
name: Documentation
on:
push:
branches:
- master
- main
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/configure-pages@v5
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install zensical
- run: zensical build --clean # (1)!
- uses: actions/upload-pages-artifact@v4
with:
path: site
- uses: actions/deploy-pages@v4
id: deployment
- At the moment, we do not recommend using caches on CI systems as the caching functionality will undergo revisions as we optimize the performance of Zensical.
When a new commit is pushed to the branch you are using for deployment
(e.g. master or main), the static site is automatically built and
deployed. Push your changes to see the workflow in action.
Your documentation should shortly appear at <username>.github.io/<repository>.
GitLab Pages¶
If you're hosting your code on GitLab, deploying to GitLab Pages can be done
by using the GitLab CI task runner. At the root of your repository, create a
task definition named .gitlab-ci.yml and copy and paste the following
contents:
pages:
stage: deploy
image: python:latest
script:
- pip install zensical
- zensical build --clean # (1)!
pages:
publish: site # (2)!
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
-
At the moment, we do not recommend using caches on CI systems as the caching functionality will undergo revisions as we optimize the performance of Zensical.
-
The Gitlab documentation says that the SSG should adapt to Gitlab Pages, which uses the folder
publicby default but it is possible to configure the default folder as shown here.
When a new commit is pushed to the default branch (e.g. master or main),
the static site is automatically built and deployed. Push your changes to see
the workflow in action.
Gitlab Pages settings
By default, Gitlab Pages publishes to a domain that includes a random
string. Untick the Use unique domain box in your Gitlab Pages settings for
your production deployment. Also make sure to set the visibility for Pages
under Settings > General > Visibility if you want a public site.
Your documentation is will now be published under <username>.gitlab.io/<repository>.
Other¶
We cannot document every hosting provider here. The following community guides describe how to deploy a Zensical site elsewhere. If you find an issue with one of these guides, please contact the author.