Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA: auto-publish dev docs on commit to main #501

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Docs

on:
push:
branches:
- main

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/setup-python@v4.6.1
with:
python-version: 3.11

- name: Install Hatch
run: python -m pip install hatch==1.6.3

- name: Deploy dev docs
run: hatch run docs:mike deploy --force --update-aliases dev
9 changes: 8 additions & 1 deletion docs/contributing/tests_formatting_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,20 @@ hatch run test:autofix
We use [mkdocs](https://www.mkdocs.org/) with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) and
[mike](https://github.com/jimporter/mike) for generating our documentation from markdown.

To use it:
To browse the documentation locally (live reload enabled):
```{.sh .copy}
hatch run docs:serve
```

Then access the documentation website on [http://localhost:8000]().

!!! note "Documentation versioning"
When browsing the docs locally, they will show up under the `latest` version ([http://localhost:8000/latest]()).

However, the online docs at [https://jorisroovers.github.io/gitlint]() are versioned, with new changes first
being published to `dev` ([https://jorisroovers.github.io/gitlint/dev]()) when they're merged in the `main` branch.
Only with gitlint releases are the versioned docs updated - `latest` always points to the latest gitlint release.

## Tools
We keep a small set of scripts in the `tools/` directory:

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ dependencies = [

[tool.hatch.envs.docs.scripts]
build = "mkdocs build --clean --strict"
serve = "mike serve"
serve = "mkdocs serve"
# Note: `mike serve` will add the doc version selector but doesn't do auto-reload

validate = [
"build", #
Expand Down