From 897faca90b5567bbabc40bdedd6ae1e9a5f9ca08 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Mon, 2 Dec 2024 11:32:50 +0100 Subject: [PATCH] Add deploy docs workflow (#51) Add a workflow that deploys the documentation to gh-pages using `mkdocs gh-deploy`. We add it as a hatch script. Fixes small typo in README.md --- .github/workflows/publish-docs.yml | 38 ++++++++++++++++++++++++++++++ README.md | 2 +- pyproject.toml | 5 ++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-docs.yml diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 0000000..0264f5a --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,38 @@ +name: publish-docs +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v4 + + - name: Configure Git Credentials + run: | + git config user.name github-actions[bot] + git config user.email github-actions[bot]@users.noreply.github.com + + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + + - uses: actions/cache@v4 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + + - name: "Build and deploy docs to gh-pages" + run: | + pip install hatch + hatch run docs:deploy --force diff --git a/README.md b/README.md index e72576c..5e04485 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ pip install -e . ## Developer tools -To manage the repo we use [hatch]{.title-ref} please install it +To manage the repo we use [hatch](https://hatch.pypa.io) please install it ``` bash pip install hatch diff --git a/pyproject.toml b/pyproject.toml index 2e80e80..7ef89cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ license = {file = "LICENSE"} [project.urls] Repository = "https://github.com/C2SM/Sirocco.git" +Documentation = "https://c2sm.github.io/Sirocco/" Changelog = "https://github.com/C2SM/Sirocco/blob/main/CHANGELOG.md" [tool.pytest.ini_options] @@ -92,3 +93,7 @@ build = [ serve = [ "mkdocs serve -f docs/mkdocs.yml", ] + +deploy = [ + "mkdocs gh-deploy -f docs/mkdocs.yml" +]