Skip to content

Commit

Permalink
feat: add the changelog action (#370)
Browse files Browse the repository at this point in the history
Co-authored-by: pyansys-ci-bot <[email protected]>
Co-authored-by: Roberto Pastor Muela <[email protected]>
  • Loading branch information
3 people committed May 2, 2024
1 parent 5d1c0ea commit f7574dc
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 16 deletions.
6 changes: 4 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
labels:
- "maintenance"
assignees:
- "pyansys-ci-bot"
commit-message:
prefix: "maint"
prefix: "ci"
1 change: 0 additions & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
env:
MAIN_PYTHON_VERSION : '3.10'
PACKAGE_NAME: 'ansys-sphinx-theme'
PACKAGE_NAMESPACE: 'ansys_sphinx_theme'
DOCUMENTATION_CNAME: 'sphinxdocs.ansys.com'
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
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:
Expand Down Expand Up @@ -80,3 +84,15 @@ jobs:
- [good first issue](https://github.com/ansys/ansys-sphinx-theme/pulls?q=label%3Agood+first+issue)
- [maintenance](https://github.com/ansys/ansys-sphinx-theme/pulls?q=label%3Amaintenance+)
- [release](https://github.com/ansys/ansys-sphinx-theme/pulls?q=label%3Arelease+)
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 }}
2 changes: 1 addition & 1 deletion doc/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Packages = Google
# Define the Ansys vocabulary
Vocab = ANSYS

[*.{md,rst}]
[*.{rst}]

# Apply the following styles
BasedOnStyles = Vale, Google
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/370.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: add the changelog action
15 changes: 15 additions & 0 deletions doc/changelog.d/changelog_template.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% if sections[""] %}
{% for category, val in definitions.items() if category in sections[""] %}

### {{ definitions[category]['name'] }}

{% 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
Original file line number Diff line number Diff line change
@@ -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
20 changes: 8 additions & 12 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
author = "ANSYS, Inc."
release = version = __version__
cname = os.getenv("DOCUMENTATION_CNAME", "sphinxdocs.ansys.com")
switcher_version = get_version_match(__version__)

# use the default ansys logo
html_logo = ansys_logo_black
Expand All @@ -50,12 +51,6 @@
"additional_breadcrumbs": [
("PyAnsys", "https://docs.pyansys.com/"),
],
"external_links": [
{
"url": "https://github.com/ansys/ansys-sphinx-theme/releases",
"name": "Changelog",
},
],
"switcher": {
"json_url": f"https://{cname}/versions.json",
"version_match": get_version_match(__version__),
Expand Down Expand Up @@ -85,12 +80,7 @@
# Intersphinx mapping
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
# kept here as an example
# "scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
# "numpy": ("https://numpy.org/devdocs", None),
# "matplotlib": ("https://matplotlib.org/stable", None),
# "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
# "pyvista": ("https://docs.pyvista.org/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master", None),
}

# numpydoc configuration
Expand Down Expand Up @@ -155,6 +145,12 @@

EXAMPLE_PATH = (THIS_PATH / "examples" / "sphinx_examples").resolve()

linkcheck_ignore = []
if switcher_version != "dev":
linkcheck_ignore.append(
f"https://github.com/ansys/ansys-sphinx-theme/releases/tag/v{__version__}"
)


def extract_example_links(
repo_fullname: str, path_relative_to_root: str, exclude_files: List[str]
Expand Down
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Ansys Sphinx Theme documentation |version|
getting_started/index.rst
user_guide/index.rst
examples/index.rst
changelog
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,39 @@ source = ["src"]

[tool.coverage.report]
show_missing = true


[tool.towncrier]
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/ansys-sphinx-theme/releases/tag/v{version}>`_ - {project_date}"
issue_format = "`#{issue} <https://github.com/ansys/ansys-sphinx-theme/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


0 comments on commit f7574dc

Please sign in to comment.