diff options
author | Joris Roovers <joris.roovers@gmail.com> | 2023-06-08 10:36:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-08 10:36:34 +0200 |
commit | b19e10c9aed41ce36edd75de801cbb0af55a8e46 (patch) | |
tree | d2bcb2513e91726bc72e2f92735341f0c6c23285 | |
parent | 9599cdef0a1e39adf1435d44afc3ea218f75bfee (diff) |
GHA: auto-publish dev docs on commit to main (#501)
Use GHA to automatically publish docs to the dev version when merged to
main.
-rw-r--r-- | .github/workflows/publish-docs.yml | 24 | ||||
-rw-r--r-- | docs/contributing/tests_formatting_docs.md | 9 | ||||
-rw-r--r-- | pyproject.toml | 3 |
3 files changed, 34 insertions, 2 deletions
diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 0000000..e0135b2 --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -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
\ No newline at end of file diff --git a/docs/contributing/tests_formatting_docs.md b/docs/contributing/tests_formatting_docs.md index 6d3227c..01b2521 100644 --- a/docs/contributing/tests_formatting_docs.md +++ b/docs/contributing/tests_formatting_docs.md @@ -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: diff --git a/pyproject.toml b/pyproject.toml index 717438c..14db408 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", # |