diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 2fb321a52..2a711151c 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -26,9 +26,34 @@ 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 }} + + pr-name: + if: github.event_name == 'pull_request' + name: Check the name of the PR + runs-on: ubuntu-latest + steps: + - name: Check commit name + uses: ansys/actions/check-pr-title@v8 + with: + token: ${{ secrets.GITHUB_TOKEN }} + code-style: name: "Code style" runs-on: ubuntu-latest + needs: pr-name steps: - uses: ansys/actions/code-style@v8 with: @@ -67,6 +92,7 @@ jobs: doc-style: name: "Documentation style" runs-on: ubuntu-latest + needs: pr-name steps: - name: PyAnsys documentation style checks uses: ansys/actions/doc-style@v8 @@ -288,7 +314,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..5df2b1d5d 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -89,3 +89,18 @@ 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 }} + bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + 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/613.added.md b/doc/changelog/613.added.md new file mode 100644 index 000000000..56c7872b4 --- /dev/null +++ b/doc/changelog/613.added.md @@ -0,0 +1 @@ +feat: changelog actions \ No newline at end of file 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..a1e16f545 --- /dev/null +++ b/doc/source/changelog.rst @@ -0,0 +1,10 @@ +Release notes +############# + +This document contains the release notes for the PyDyna project. + +.. vale off + +.. towncrier release notes start + +.. vale on 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 6148b1378..b25319fbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] name = "ansys-dyna-core" -version = "0.4.dev0" +version = "0.6.dev0" description = "Python interface to LS-DYNA Service" readme = "README.rst" requires-python = ">=3.10,<4" @@ -83,10 +83,10 @@ doc = [ name = "ansys.dyna.core" [project.urls] -Source = "https://github.com/pyansys/pydyna" +Source = "https://github.com/ansys/pydyna" Homepage = "https://dyna.docs.pyansys.com" Documentation = "https://dyna.docs.pyansys.com" -Tracker = "https://github.com/pyansys/pydyna/issues" +Tracker = "https://github.com/ansys/pydyna/issues" [tool.black] line-length = 120 @@ -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