Skip to content

Commit b6315e3

Browse files
feat: add doc-changelog and doc-deploy-changelog actions (#164)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 5c05889 commit b6315e3

File tree

6 files changed

+92
-3
lines changed

6 files changed

+92
-3
lines changed

.github/workflows/ci_cd.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20+
update-changelog:
21+
name: "Update CHANGELOG for new tag"
22+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: write
26+
pull-requests: write
27+
steps:
28+
- uses: ansys/actions/doc-deploy-changelog@main
29+
with:
30+
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
31+
32+
style:
33+
name: Code style
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: PyAnsys code style checks
37+
uses: ansys/actions/code-style@v5
38+
with:
39+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
2040

2141
doc-style:
2242
name: "Documentation style"
@@ -89,7 +109,7 @@ jobs:
89109
release:
90110
name: "Release project"
91111
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
92-
needs: [build-library]
112+
needs: [build-library, update-changelog]
93113
runs-on: ubuntu-latest
94114
steps:
95115
- name: "Release to the public PyPI repository"
@@ -114,5 +134,3 @@ jobs:
114134
with:
115135
cname: ${{ env.DOCUMENTATION_CNAME }}
116136
token: ${{ secrets.GITHUB_TOKEN }}
117-
118-

.github/workflows/label.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Labeler
22
on:
33
pull_request:
4+
# opened, reopened, and synchronize are default for pull_request
5+
# edited - when PR title or body is changed
6+
# labeled - when labels are added to PR
7+
types: [opened, reopened, synchronize, edited, labeled]
48
push:
59
branches: [ main ]
610
paths:
@@ -82,3 +86,15 @@ jobs:
8286
- [good first issue](https://github.com/ansys/pre-commit-hooks/pulls?q=label%3Agood+first+issue)
8387
- [maintenance](https://github.com/ansys/pre-commit-hooks/pulls?q=label%3Amaintenance+)
8488
- [release](https://github.com/ansys/pre-commit-hooks/pulls?q=label%3Arelease+)
89+
90+
changelog-fragment:
91+
name: "Create changelog fragment"
92+
needs: [labeler]
93+
permissions:
94+
contents: write
95+
pull-requests: write
96+
runs-on: ubuntu-latest
97+
steps:
98+
- uses: ansys/actions/doc-changelog@main
99+
with:
100+
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This document follows the conventions laid out in [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0).
44

5+
This project uses [towncrier](https://towncrier.readthedocs.io/) and the changes for the upcoming release can be found in <https://github.com/ansys/pre-commit-hooks/tree/main/doc/changelog.d/>.
6+
7+
<!-- towncrier release notes start -->
8+
59
## [0.2.9](https://github.com/ansys/pre-commit-hooks/releases/tag/v0.2.9) - February 16 2024
610

711
### Changed

doc/changelog.d/164.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
feat: add doc-changelog and doc-deploy-changelog actions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% if sections[""] %}
2+
{% for category, val in definitions.items() if category in sections[""] %}
3+
4+
### {{ definitions[category]['name'] }}
5+
6+
{% for text, values in sections[""][category].items() %}
7+
- {{ text }} {{ values|join(', ') }}
8+
{% endfor %}
9+
10+
{% endfor %}
11+
{% else %}
12+
No significant changes.
13+
14+
15+
{% endif %}

pyproject.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,38 @@ addopts = "--cov=ansys.pre_commit_hooks --cov-report term-missing -vv"
8383
testpaths = [
8484
"tests",
8585
]
86+
87+
[tool.towncrier]
88+
package = "ansys.pre_commit_hooks"
89+
directory = "doc/changelog.d"
90+
filename = "CHANGELOG.md"
91+
start_string = "<!-- towncrier release notes start -->\n"
92+
underlines = ["", "", ""]
93+
template = "doc/changelog.d/changelog_template.jinja"
94+
title_format = "## [{version}](https://github.com/ansys/pre-commit-hooks/releases/tag/v{version}) - {project_date}"
95+
issue_format = "[#{issue}](https://github.com/ansys/pre-commit-hooks/pull/{issue})"
96+
97+
[[tool.towncrier.type]]
98+
directory = "added"
99+
name = "Added"
100+
showcontent = true
101+
102+
[[tool.towncrier.type]]
103+
directory = "changed"
104+
name = "Changed"
105+
showcontent = true
106+
107+
[[tool.towncrier.type]]
108+
directory = "fixed"
109+
name = "Fixed"
110+
showcontent = true
111+
112+
[[tool.towncrier.type]]
113+
directory = "dependencies"
114+
name = "Dependencies"
115+
showcontent = true
116+
117+
[[tool.towncrier.type]]
118+
directory = "miscellaneous"
119+
name = "Miscellaneous"
120+
showcontent = true

0 commit comments

Comments
 (0)