From 123ac5e82d8fa7b0d7865a74c3897e6cca2d9670 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Wed, 13 Nov 2024 15:04:54 +0100 Subject: [PATCH] ci: configure changelog --- .github/workflows/ci_cd.yml | 16 ++++++++++- .github/workflows/label.yml | 12 +++++++++ CHANGELOG.md | 3 +++ doc/changelog/template | 17 ++++++++++++ doc/source/changelog.rst | 8 ++++++ doc/source/conf.py | 1 + doc/source/index.rst | 1 + pyproject.toml | 53 +++++++++++++++++++++++++++++++++++++ 8 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md create mode 100644 doc/changelog/template create mode 100644 doc/source/changelog.rst diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index c999d1266..b08dff970 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -26,6 +26,20 @@ concurrency: jobs: + update-changelog: + name: "Update CHANGELOG (on release)" + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: ansys/actions/doc-deploy-changelog@v8 + with: + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + code-style: name: "Code style" runs-on: ubuntu-latest @@ -288,7 +302,7 @@ jobs: release: name: Release project if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - needs: [build-library] + needs: [update-changelog, build-library] runs-on: ubuntu-latest steps: - name: "Release to the public PyPI repository" diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index e8ce38351..3a5d37bd9 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -89,3 +89,15 @@ jobs: - [maintenance](https://github.com/pyansys/pyDyna/pulls?q=label%3Amaintenance+) - [release](https://github.com/pyansys/pyDyna/pulls?q=label%3Arelease+) - [testing](https://github.com/pyansys/pyDyna/pulls?q=label%Atesting+) + + changelog-fragment: + name: "Create changelog fragment" + needs: [commenter] + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: ansys/actions/doc-changelog@v8 + with: + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..2c2fb726e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +This project uses [towncrier](https://towncrier.readthedocs.io/). Changes for +the upcoming release can be found in +[doc/source/changelog.rst](doc/source/changelog.rst). diff --git a/doc/changelog/template b/doc/changelog/template new file mode 100644 index 000000000..c5fe4e7da --- /dev/null +++ b/doc/changelog/template @@ -0,0 +1,17 @@ +{% if sections[""] %} +{% for category, val in definitions.items() if category in sections[""] %} + +{{ definitions[category]['name'] }} +{% set underline = '^' * definitions[category]['name']|length %} +{{ underline }} + +{% for text, values in sections[""][category].items() %} +- {{ text }} {{ values|join(', ') }} +{% endfor %} + +{% endfor %} +{% else %} +No significant changes. + + +{% endif %} diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst new file mode 100644 index 000000000..20b237681 --- /dev/null +++ b/doc/source/changelog.rst @@ -0,0 +1,8 @@ +Release notes +############# + +This document contains the release notes for the PyDyna project. + +.. vale off + +.. towncrier release notes start diff --git a/doc/source/conf.py b/doc/source/conf.py index d11a77e53..baa7ef965 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -96,6 +96,7 @@ # Read link all targets from file with open("links.rst") as f: rst_epilog += f.read() +linkcheck_exclude_documents = ["changelog"] inheritance_graph_attrs = dict(rankdir="RL", size='"8.0, 10.0"', fontsize=14, ratio="compress") inheritance_node_attrs = dict(shape="ellipse", fontsize=14, height=0.75, color="dodgerblue1", style="filled") diff --git a/doc/source/index.rst b/doc/source/index.rst index cd15737ae..20946991c 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -18,3 +18,4 @@ PyDYNA documentation |version| examples/index {% endif %} contributing + changelog diff --git a/pyproject.toml b/pyproject.toml index 92ffe5fa0..67e4d8412 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,3 +108,56 @@ show_missing = true minversion = "7.1" addopts = "-ra --cov=ansys.dyna.core --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv" testpaths = ["tests"] + +[tool.towncrier] +directory = "doc/changelog" +filename = "doc/source/changelog.rst" +template = "doc/changelog/template" +start_string = ".. towncrier release notes start\n" +title_format = "`{version} `_ - {project_date}" +issue_format = "`#{issue} `_" + +[[tool.towncrier.type]] +directory = "added" +name = "Added" +showcontent = true + +[[tool.towncrier.type]] +directory = "dependencies" +name = "Dependencies" +showcontent = true + +[[tool.towncrier.type]] +directory = "documentation" +name = "Documentation" +showcontent = true + +[[tool.towncrier.type]] +directory = "fixed" +name = "Fixed" +showcontent = true + +[[tool.towncrier.type]] +directory = "maintenance" +name = "Maintenance" +showcontent = true + +[[tool.towncrier.type]] +directory = "miscellaneous" +name = "Miscellaneous" +showcontent = true + +[[tool.towncrier.type]] +directory = "documentation" +name = "Documentation" +showcontent = true + +[[tool.towncrier.type]] +directory = "maintenance" +name = "Maintenance" +showcontent = true + +[[tool.towncrier.type]] +directory = "test" +name = "Test" +showcontent = true