Skip to content

Commit

Permalink
ci: configure changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgepiloto committed Nov 13, 2024
1 parent 4549981 commit 123ac5e
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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).
17 changes: 17 additions & 0 deletions doc/changelog/template
Original file line number Diff line number Diff line change
@@ -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 %}
8 changes: 8 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Release notes
#############

This document contains the release notes for the PyDyna project.

.. vale off
.. towncrier release notes start
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ PyDYNA documentation |version|
examples/index
{% endif %}
contributing
changelog
53 changes: 53 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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} <https://github.com/ansys/pydyna/releases/tag/v{version}>`_ - {project_date}"
issue_format = "`#{issue} <https://github.com/ansys/pydyna/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 = "documentation"
name = "Documentation"
showcontent = true

[[tool.towncrier.type]]
directory = "maintenance"
name = "Maintenance"
showcontent = true

[[tool.towncrier.type]]
directory = "test"
name = "Test"
showcontent = true

0 comments on commit 123ac5e

Please sign in to comment.