Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implementing ansys/actions/changelogs and adding release note in documentation #3019

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
4 changes: 4 additions & 0 deletions .github/labeler.yml
Expand Up @@ -13,3 +13,7 @@ Dependencies:
CI/CD:
- changed-files:
- any-glob-to-any-file: ['docker/**/*', '.github/**/*', '.ci/**/*']

Testing:
- changed-files:
- any-glob-to-any-file: ['tests/*', 'tests/**/*']
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -59,6 +59,19 @@ permissions:

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@v6
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}

doc-style:
name: "Documentation style check"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -816,7 +829,7 @@ jobs:
release:
name: "Release"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [smoke-tests, docs-build, build-test, build-test-ubuntu, build-test-ubuntu-minimal]
needs: [smoke-tests, docs-build, build-test, build-test-ubuntu, build-test-ubuntu-minimal, update-changelog]
runs-on: ubuntu-latest
steps:
- name: Set up Python
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/label.yml
@@ -1,7 +1,10 @@
name: "Pull Request Labeler"
on:
pull_request:
types: [opened, reopened]
# 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:
Expand Down Expand Up @@ -101,3 +104,15 @@ jobs:
- [Examples](https://github.com/ansys/pymapdl/pulls?q=label%3Aexamples+)
- [Maintenance](https://github.com/ansys/pymapdl/pulls?q=label%3Amaintenance+)
- [CI/CD](https://github.com/ansys/pymapdl/pulls?q=label%3Aci%2Fcd+)

changelog-fragment:
name: "Create changelog fragment"
needs: [labeler]
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-changelog@v6
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,7 @@
# CHANGELOG

This project uses [towncrier](https://towncrier.readthedocs.io/) to generate changelogs.

For more information, see the [raw release notes](doc/source/changelog.rst).

[Published release notes](https://mapdl.docs.pyansys.com/version/stable/changelog.html) can be found in the online documentation.
1 change: 1 addition & 0 deletions doc/changelog.d/3019.miscellaneous.md
@@ -0,0 +1 @@
feat: implementing `ansys/actions/changelogs` and adding release note in documentation
17 changes: 17 additions & 0 deletions 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 %}
13 changes: 13 additions & 0 deletions 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
12 changes: 10 additions & 2 deletions doc/source/conf.py
Expand Up @@ -57,6 +57,7 @@
# The short X.Y version
release = version = __version__
cname = os.getenv("DOCUMENTATION_CNAME", "mapdl.docs.pyansys.com")
switcher_version = get_version_match(__version__)

REPOSITORY_NAME = "pymapdl"
USERNAME = "ansys"
Expand Down Expand Up @@ -223,6 +224,13 @@
"pyvista.Plotter.show",
]

# 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/pymapdl/releases/tag/v{__version__}"
)

user_agent = """curl https://www.ansys.com -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.3"""

# The name of the Pygments (syntax highlighting) style to use.
Expand Down Expand Up @@ -293,12 +301,12 @@
],
"switcher": {
"json_url": f"https://{cname}/versions.json",
"version_match": get_version_match(__version__),
"version_match": switcher_version,
},
"use_meilisearch": {
"api_key": os.getenv("MEILISEARCH_PUBLIC_API_KEY", ""),
"index_uids": {
f"pymapdl-v{get_version_match(__version__).replace('.', '-')}": "PyMAPDL",
f"pymapdl-v{switcher_version.replace('.', '-')}": "PyMAPDL",
},
},
}
Expand Down
1 change: 1 addition & 0 deletions doc/source/index.rst
Expand Up @@ -15,6 +15,7 @@
mapdl_commands/index
api/index
examples/index
changelog


.. image:: ../source/_static/logo_dark.png
Expand Down
34 changes: 34 additions & 0 deletions pyproject.toml
Expand Up @@ -230,3 +230,37 @@ override_SS05 = [ # override SS05 to allow docstrings starting with these words
# '^Assess ',
# '^Access ',
]

[tool.towncrier]
package = "ansys.math.core"
directory = "doc/changelog.d"
filename = "doc/source/changelog.rst"
template = "doc/changelog.d/changelog_template.jinja"
start_string = ".. towncrier release notes start\n"
title_format = "`{version} <https://github.com/ansys/pymapdl/releases/tag/v{version}>`_ - {project_date}"
issue_format = "`#{issue} <https://github.com/ansys/pymapdl/pull/{issue}>`_"

[[tool.towncrier.type]]
directory = "added"
name = "Added"
showcontent = true

[[tool.towncrier.type]]
directory = "changed"
name = "Changed"
showcontent = true

[[tool.towncrier.type]]
directory = "fixed"
name = "Fixed"
showcontent = true

[[tool.towncrier.type]]
directory = "dependencies"
name = "Dependencies"
showcontent = true

[[tool.towncrier.type]]
directory = "miscellaneous"
name = "Miscellaneous"
showcontent = true