From 29ad06fc24b9ed864c6aa9eae900fd2e99009a18 Mon Sep 17 00:00:00 2001 From: Maxime Rey Date: Fri, 27 Dec 2024 11:44:58 +0100 Subject: [PATCH] Add the changelog. --- .github/workflows/ci_cd.yml | 14 ++++++++ .github/workflows/label.yml | 17 +++++++++ doc/changelog.d/changelog_template.jinja | 17 +++++++++ doc/source/changelog.rst | 13 +++++++ doc/source/conf.py | 11 ++++++ doc/source/index.rst | 1 + pyproject.toml | 45 ++++++++++++++++++++++++ 7 files changed, 118 insertions(+) create mode 100644 doc/changelog.d/changelog_template.jinja create mode 100644 doc/source/changelog.rst diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index c386b35c3ae..eda2167140b 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -25,6 +25,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 }} + pr-title: if: github.event_name == 'pull_request' name: Check the title of the pull request diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 596cace4c8f..72308f39f23 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -1,6 +1,11 @@ name: Labeler + on: pull_request: + # opened, reopened, and synchronize are default for pull_request + # edited - when PR title or body is changed + # labeled - when labels are added to PR + types: [opened, reopened, synchronize, edited, labeled] push: branches: [ main ] paths: @@ -89,3 +94,15 @@ jobs: - [maintenance](https://github.com/ansys/pyaedt/pulls?q=label%3Amaintenance+) - [release](https://github.com/ansys/pyaedt/pulls?q=label%3Arelease+) - [testing](https://github.com/ansys/pyaedt/pulls?q=label%Atesting+) + +changelog-fragment: + name: "Create changelog fragment" + needs: [labeler] + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: ansys/actions/doc-changelog@v8 + with: + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} \ No newline at end of file diff --git a/doc/changelog.d/changelog_template.jinja b/doc/changelog.d/changelog_template.jinja new file mode 100644 index 00000000000..c5fe4e7dad0 --- /dev/null +++ b/doc/changelog.d/changelog_template.jinja @@ -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 00000000000..cb1b8c0b44c --- /dev/null +++ b/doc/source/changelog.rst @@ -0,0 +1,13 @@ +.. _ref_release_notes: + +Release notes +############# + +This document contains the release notes for the project. + +.. vale off + +.. towncrier release notes start + + +.. vale on \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index d8e601b5423..0677cf726dd 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -330,3 +330,14 @@ def setup(app): # Change the preamble of latex with customized title page # variables are the title of pdf, watermark latex_elements = {"preamble": latex.generate_preamble(html_title)} + +linkcheck_ignore = [ + r"https://download.ansys.com/", +] + +# If we are on a release, we have to ignore the "release" URLs, since it is not +# available until the release is published. +if switcher_version != "dev": + linkcheck_ignore.append( + f"https://github.com/ansys/pyansys-geometry/releases/tag/v{__version__}" + ) # noqa: E501 \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst index 32528e3a1a9..2e4cca26ba7 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -67,3 +67,4 @@ enabling straightforward and efficient automation in your workflow. User_guide/index API/index Examples + changelog \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 2e45dbd248a..4f5fb8b6b5a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -215,3 +215,48 @@ exclude = [ '\.tests', # missing docstring for tests 'HistoryProps.', # bad RT05 because of the base class named OrderedDict ] + +[tool.towncrier] +package = "ansys.." +directory = "doc/changelog.d" +filename = "CHANGELOG.md" +start_string = "\n" +underlines = ["", "", ""] +template = "doc/changelog.d/changelog_template.jinja" +title_format = "## [{version}](https://github.com/ansys/pyaedt/releases/tag/v{version}) - {project_date}" +issue_format = "[#{issue}](https://github.com/ansys/pyaedt/pull/{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 = "test" +name = "Test" +showcontent = true \ No newline at end of file