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

docs: implementing changelog as part of the documentation #465

Merged
merged 4 commits into from
Apr 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
81 changes: 81 additions & 0 deletions doc/source/migrations/docs-changelog-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,87 @@
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}


Implemeting the changelog as part of your documentation

Check failure on line 127 in doc/source/migrations/docs-changelog-setup.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/migrations/docs-changelog-setup.rst#L127

[Vale.Spelling] Did you really mean 'Implemeting'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'Implemeting'?", "location": {"path": "doc/source/migrations/docs-changelog-setup.rst", "range": {"start": {"line": 127, "column": 1}}}, "severity": "ERROR"}
-------------------------------------------------------
RobPasMue marked this conversation as resolved.
Show resolved Hide resolved

The previous steps set up the changelog for your repository. To implement the changelog in your documentation,
some modifications have to be performed. Based on the PyAnsys libraries standards, this section assumes that
the repository has a ``docs`` directory with a Sphinx documentation setup.

1. Create a new file named ``changelog.rst`` in the ``docs`` directory. Add the following lines to the file:

.. code:: rst

.. _ref_release_notes:

Release notes
#############

This document contains the release notes for the project.

.. vale off

.. towncrier release notes start

2. Add the ``changelog.rst`` file to the ``index.rst`` file in the ``docs`` directory.

.. code:: rst

.. toctree::
:hidden:
:maxdepth: 3

changelog
<other files>


3. Add the following lines to the ``conf.py`` file in the ``docs`` directory, replacing ``{repo-name}``
RobPasMue marked this conversation as resolved.
Show resolved Hide resolved
and ``{org_name}`` with the name of the repository:
RobPasMue marked this conversation as resolved.
Show resolved Hide resolved

.. code:: python

# 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(
rf"https://github.com/{org_name}/{repo_name}/releases/download/v{__version__}/.*"
)
linkcheck_ignore.append(
f"https://github.com/{org_name}/{repo_name}/releases/tag/v{__version__}"
)
RobPasMue marked this conversation as resolved.
Show resolved Hide resolved

4. Modify the ``pyproject.toml`` file to include the following lines, replacing ``{repo-name}``
and ``{org_name}`` with the name of the repository:

.. code:: toml

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

RobPasMue marked this conversation as resolved.
Show resolved Hide resolved
.. note::

The previous ``CHANGELOG.md`` file can be removed from the repository, as the changelog is now part of the documentation.

However, if the ``CHANGELOG.md`` file is kept, it can be adapted to include the link to the documentation changelog.

For example, the ``CHANGELOG.md`` file could look like this:

.. code:: md

This project uses [towncrier](https://towncrier.readthedocs.io/) and the
changes for the upcoming release can be found in
this [repository file](doc/changelog.d/changelog.rst).


A reference pull request for the changes can be found in the `PyAnsys Geometry repository <https://github.com/ansys/pyansys-geometry/pull/1138>`_.
This pull request includes some other changes, but the changelog implementation is the same as described in this document.

``towncrier`` commands
----------------------

Expand Down