From ddf90aecdc00f39e59c846800acfd4325e560aa1 Mon Sep 17 00:00:00 2001 From: Marnik Bercx <mbercx@gmail.com> Date: Fri, 10 Jan 2025 10:34:53 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A7=20Add=20`update=5Fchangelog.py?= =?UTF-8?q?`=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/update_changelog.py | 90 +++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/update_changelog.py diff --git a/.github/workflows/update_changelog.py b/.github/workflows/update_changelog.py new file mode 100644 index 0000000..44671ad --- /dev/null +++ b/.github/workflows/update_changelog.py @@ -0,0 +1,90 @@ +#!/bin/bash +"""Script for automatically updating the `CHANGELOG.md` based on the commits since the latest release tag.""" +import re +import subprocess +from pathlib import Path + +DEFAULT_CHANGELOG_SECTIONS = """ +### โผ๏ธ Breaking changes + + +### โจ New features + + +### ๐๏ธ Deprecations + + +### ๐ Improvements + + +### ๐ Bug fixes + + +### ๐ Documentation + + +### ๐ง Maintenance + + +### โฌ๏ธ Update dependencies + + +### ๐งช Tests + + +### โป๏ธ Refactor + +""" + + +def update_changelog(): + """Update the `CHANGELOG.md` for a first draft of the release.""" + + print('๐ Checking the current version number') + current_changelog = Path('CHANGELOG.md').read_text(encoding='utf-8') + + from aiida_pseudo import __version__ + + if str(__version__) in current_changelog: + print('๐ Current version already in `CHANGELOG.md`. Skipping...') + return + + print('โฌ๏ธ Found updated version number, adapting `CHANGELOG.md`.') + tags = subprocess.run(['git', 'tag', '--sort=v:refname'], capture_output=True, check=True, encoding='utf-8').stdout + latest_tag = re.findall(r'(v\d\.\d\.\d)\n', tags)[-1] + + print(f'๐ Comparing with latest tag `{latest_tag}`.') + commits = subprocess.run( + ['git', 'log', "--pretty=format:'%h|%H|%s'", f'{latest_tag}..origin/main'], + capture_output=True, + check=True, + encoding='utf-8', + ).stdout + + pr_pattern = re.compile(r'\(\S(?P<pr_number>\d+)\)') + + changelog_message = f'## v{__version__}\n' + DEFAULT_CHANGELOG_SECTIONS + + for commit in commits.splitlines(): + hash_short, hash_long, message = commit.strip("'").split('|', maxsplit=2) + + # Remove the PR number from the commit message + pr_match = pr_pattern.search(message) + + if pr_match is not None: + pr_number = pr_match.groupdict()['pr_number'] + message = message.replace(rf'(#{pr_number})', '') + + # Add the commit hash (short) to link to the changelog + message += f' [[{hash_short}](https://github.com/aiidateam/aiida-pseudo/commit/{hash_long})]' + changelog_message += f'\n* {message}' + + with Path('CHANGELOG.md').open('w', encoding='utf8') as handle: + new_changelog = current_changelog.replace('# Change log', f'# Change log\n\n{changelog_message}') + handle.write(new_changelog) + + print("๐ Success! Finalise the `CHANGELOG.md` and let's get this baby released.") + + +if __name__ == '__main__': + update_changelog() From 4a007c58970e2cc53a34d7a1ddbcbfa272e1517a Mon Sep 17 00:00:00 2001 From: Marnik Bercx <mbercx@gmail.com> Date: Mon, 13 Jan 2025 21:14:36 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9A=80=20Release=20`v1.7.0`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 15 +++++++++++++++ src/aiida_pseudo/__init__.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d53737..c8b602c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Change log +## `1.7.0` - 2025-01-13 + +### โจ New features + +* Add support for `StructureData from `aiida-atomistic` [[9b29ae7](https://github.com/aiidateam/aiida-pseudo/commit/9b29ae7ca95222b46f89d5909fedeb009cb021e9)] + +### ๐ Improvements + +* Bypass the certificate check for pseudo dojo. [[ac84418](https://github.com/aiidateam/aiida-pseudo/commit/ac84418d3fe28415d0535856ecbaa551962ccf86)] + +### ๐ง Maintenance + +* Add path to sphinx `conf.py` to RTD configuration [[27e9e10](https://github.com/aiidateam/aiida-pseudo/commit/27e9e10794ec50741f53e1eb0b2aa3fbe33ed1d6)] +* Pin requirement `sphinx-autoapi~=3.3.3` [[36c4e6f](https://github.com/aiidateam/aiida-pseudo/commit/36c4e6fb9a754de400ac6ca8a16f97d1e25f5494)] + ## `1.6.0` - 2024-11-04 ### Dependencies diff --git a/src/aiida_pseudo/__init__.py b/src/aiida_pseudo/__init__.py index b68b56f..6dbc7db 100644 --- a/src/aiida_pseudo/__init__.py +++ b/src/aiida_pseudo/__init__.py @@ -1,2 +1,2 @@ """AiiDA plugin that simplifies working with pseudo potentials.""" -__version__ = '1.6.0' +__version__ = '1.7.0'