gha-utils 4.5.2__py3-none-any.whl → 4.5.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gha-utils might be problematic. Click here for more details.
- gha_utils/__init__.py +1 -1
- gha_utils/changelog.py +18 -19
- gha_utils/cli.py +1 -1
- gha_utils/metadata.py +13 -9
- {gha_utils-4.5.2.dist-info → gha_utils-4.5.3.dist-info}/METADATA +9 -1
- gha_utils-4.5.3.dist-info/RECORD +12 -0
- {gha_utils-4.5.2.dist-info → gha_utils-4.5.3.dist-info}/WHEEL +1 -1
- gha_utils-4.5.2.dist-info/RECORD +0 -12
- {gha_utils-4.5.2.dist-info → gha_utils-4.5.3.dist-info}/entry_points.txt +0 -0
- {gha_utils-4.5.2.dist-info → gha_utils-4.5.3.dist-info}/top_level.txt +0 -0
gha_utils/__init__.py
CHANGED
gha_utils/changelog.py
CHANGED
|
@@ -19,6 +19,7 @@ from __future__ import annotations
|
|
|
19
19
|
import logging
|
|
20
20
|
import re
|
|
21
21
|
import sys
|
|
22
|
+
from functools import cached_property
|
|
22
23
|
from pathlib import Path
|
|
23
24
|
from textwrap import indent
|
|
24
25
|
|
|
@@ -38,10 +39,20 @@ class Changelog:
|
|
|
38
39
|
self.content = initial_changelog
|
|
39
40
|
logging.debug(f"Initial content set to:\n{self.content}")
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
@cached_property
|
|
43
|
+
def current_version(self) -> str | None:
|
|
44
|
+
# Extract current version as defined by bump-my-version.
|
|
45
|
+
config_file = Path("./pyproject.toml").resolve()
|
|
46
|
+
logging.info(f"Open {config_file}")
|
|
47
|
+
config = tomllib.loads(config_file.read_text(encoding="UTF-8"))
|
|
48
|
+
current_version = config["tool"]["bumpversion"]["current_version"]
|
|
49
|
+
logging.info(f"Current version: {current_version}")
|
|
50
|
+
return current_version if current_version else None
|
|
51
|
+
|
|
52
|
+
def update(self) -> str:
|
|
42
53
|
r"""Adds a new empty entry at the top of the changelog.
|
|
43
54
|
|
|
44
|
-
|
|
55
|
+
Will return the same content as the current changelog if it has already been updated.
|
|
45
56
|
|
|
46
57
|
This is designed to be used just after a new release has been tagged. And before a
|
|
47
58
|
post-release version increment is applied with a call to:
|
|
@@ -98,16 +109,6 @@ class Changelog:
|
|
|
98
109
|
Would not tag since we are not committing
|
|
99
110
|
```
|
|
100
111
|
"""
|
|
101
|
-
# Extract current version as defined by bump-my-version.
|
|
102
|
-
config_file = Path("./pyproject.toml").resolve()
|
|
103
|
-
logging.info(f"Open {config_file}")
|
|
104
|
-
config = tomllib.loads(config_file.read_text(encoding="UTF-8"))
|
|
105
|
-
current_version = config["tool"]["bumpversion"]["current_version"]
|
|
106
|
-
logging.info(f"Current version: {current_version}")
|
|
107
|
-
assert current_version
|
|
108
|
-
|
|
109
|
-
assert current_version in self.content
|
|
110
|
-
|
|
111
112
|
# Extract parts of the changelog or set default values.
|
|
112
113
|
SECTION_START = "##"
|
|
113
114
|
sections = self.content.split(SECTION_START, 2)
|
|
@@ -125,7 +126,7 @@ class Changelog:
|
|
|
125
126
|
# Update GitHub's comparison URL to target the main branch.
|
|
126
127
|
new_entry = re.sub(
|
|
127
128
|
rf"v{VERSION_REGEX}\.\.\.v{VERSION_REGEX}",
|
|
128
|
-
f"v{current_version}...main",
|
|
129
|
+
f"v{self.current_version}...main",
|
|
129
130
|
new_entry,
|
|
130
131
|
count=1,
|
|
131
132
|
)
|
|
@@ -143,9 +144,7 @@ class Changelog:
|
|
|
143
144
|
)
|
|
144
145
|
logging.info("New generated section:\n" + indent(new_entry, " " * 2))
|
|
145
146
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
# Recompose full changelog with new top entry.
|
|
151
|
-
return f"{changelog_header}{new_entry}{history}"
|
|
147
|
+
history = current_entry + past_entries
|
|
148
|
+
if new_entry not in history:
|
|
149
|
+
history = new_entry + history
|
|
150
|
+
return (changelog_header + history).rstrip()
|
gha_utils/cli.py
CHANGED
|
@@ -187,7 +187,7 @@ def changelog(ctx, source, changelog_path):
|
|
|
187
187
|
|
|
188
188
|
changelog = Changelog(initial_content)
|
|
189
189
|
content = changelog.update()
|
|
190
|
-
if
|
|
190
|
+
if content == initial_content:
|
|
191
191
|
logging.warning("Changelog already up to date. Do nothing.")
|
|
192
192
|
ctx.exit()
|
|
193
193
|
|
gha_utils/metadata.py
CHANGED
|
@@ -398,11 +398,13 @@ class Metadata:
|
|
|
398
398
|
current_version = Metadata.get_current_version()
|
|
399
399
|
|
|
400
400
|
sha_list.append(commit.hash)
|
|
401
|
-
include_list.append(
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
401
|
+
include_list.append(
|
|
402
|
+
{
|
|
403
|
+
"commit": commit.hash,
|
|
404
|
+
"short_sha": commit.hash[:SHORT_SHA_LENGTH],
|
|
405
|
+
"current_version": current_version,
|
|
406
|
+
}
|
|
407
|
+
)
|
|
406
408
|
|
|
407
409
|
# Restore the repository to its initial state.
|
|
408
410
|
if past_commit_lookup:
|
|
@@ -412,10 +414,12 @@ class Metadata:
|
|
|
412
414
|
logging.debug("Unstash local changes that were previously saved.")
|
|
413
415
|
git.repo.git.stash("pop")
|
|
414
416
|
|
|
415
|
-
return Matrix(
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
return Matrix(
|
|
418
|
+
{
|
|
419
|
+
"commit": sha_list,
|
|
420
|
+
"include": include_list,
|
|
421
|
+
}
|
|
422
|
+
)
|
|
419
423
|
|
|
420
424
|
@cached_property
|
|
421
425
|
def event_type(self) -> WorkflowEvent | None: # type: ignore[valid-type]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gha-utils
|
|
3
|
-
Version: 4.5.
|
|
3
|
+
Version: 4.5.3
|
|
4
4
|
Summary: ⚙️ CLI helpers for GitHub Actions + reuseable workflows
|
|
5
5
|
Author-email: Kevin Deldycke <kevin@deldycke.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/kdeldycke/workflows
|
|
@@ -54,6 +54,13 @@ Requires-Dist: pyproject-metadata ~=0.8.0
|
|
|
54
54
|
Requires-Dist: wcmatch >=8.5
|
|
55
55
|
Requires-Dist: backports.strenum ~=1.3.1 ; python_version < "3.11"
|
|
56
56
|
Requires-Dist: tomli ~=2.0.1 ; python_version < "3.11"
|
|
57
|
+
Provides-Extra: test
|
|
58
|
+
Requires-Dist: coverage[toml] ~=7.6.0 ; extra == 'test'
|
|
59
|
+
Requires-Dist: pytest ~=8.3.1 ; extra == 'test'
|
|
60
|
+
Requires-Dist: pytest-cases ~=3.8.3 ; extra == 'test'
|
|
61
|
+
Requires-Dist: pytest-cov ~=5.0.0 ; extra == 'test'
|
|
62
|
+
Requires-Dist: pytest-github-actions-annotate-failures ~=0.2.0 ; extra == 'test'
|
|
63
|
+
Requires-Dist: pytest-randomly ~=3.15.0 ; extra == 'test'
|
|
57
64
|
|
|
58
65
|
# `gha-utils` CLI + reusable workflows
|
|
59
66
|
|
|
@@ -61,6 +68,7 @@ Requires-Dist: tomli ~=2.0.1 ; python_version < "3.11"
|
|
|
61
68
|
[](https://pypi.python.org/pypi/gha-utils)
|
|
62
69
|
[](http://mypy-lang.org/)
|
|
63
70
|
[](https://github.com/kdeldycke/workflows/actions/workflows/tests.yaml?query=branch%3Amain)
|
|
71
|
+
[](https://app.codecov.io/gh/kdeldycke/workflows)
|
|
64
72
|
|
|
65
73
|
Thanks to this project, I am able to **release Python packages multiple times a day with only 2-clicks**.
|
|
66
74
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
gha_utils/__init__.py,sha256=nwJF-TNbGW0vPLIN9UbZJNTT83fXwRXiy1v5k6dKAl4,865
|
|
2
|
+
gha_utils/__main__.py,sha256=Dck9BjpLXmIRS83k0mghAMcYVYiMiFLltQdfRuMSP_Q,1703
|
|
3
|
+
gha_utils/changelog.py,sha256=oahY88A9FRV14f1JSFKIiYrN_TS7Jo3QlljXqJbeuaE,5892
|
|
4
|
+
gha_utils/cli.py,sha256=f1NRPffvgl5waBau8-5twXO7n3By_797npWBR_22XoM,9217
|
|
5
|
+
gha_utils/mailmap.py,sha256=snSQBn1BDZ21783l4yCkQc3RLIxh5X6QCunFRkDj-24,6301
|
|
6
|
+
gha_utils/metadata.py,sha256=MhFzNlx5nE2Z9DI89yPsloik-JL40_yBzO-K1Ly5Vn8,47283
|
|
7
|
+
gha_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
gha_utils-4.5.3.dist-info/METADATA,sha256=CV0NUhzAl7k_A9a3IG-tmcyYT5MPajuMeTcBugOZIH4,18485
|
|
9
|
+
gha_utils-4.5.3.dist-info/WHEEL,sha256=uCRv0ZEik_232NlR4YDw4Pv3Ajt5bKvMH13NUU7hFuI,91
|
|
10
|
+
gha_utils-4.5.3.dist-info/entry_points.txt,sha256=8bJOwQYf9ZqsLhBR6gUCzvwLNI9f8tiiBrJ3AR0EK4o,54
|
|
11
|
+
gha_utils-4.5.3.dist-info/top_level.txt,sha256=C94Blb61YkkyPBwCdM3J_JPDjWH0lnKa5nGZeZ5M6yE,10
|
|
12
|
+
gha_utils-4.5.3.dist-info/RECORD,,
|
gha_utils-4.5.2.dist-info/RECORD
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
gha_utils/__init__.py,sha256=dVbNU3AKtU7SNZ3K7bIcJ2IZFIPUJZrzkCoRMaHw1v8,865
|
|
2
|
-
gha_utils/__main__.py,sha256=Dck9BjpLXmIRS83k0mghAMcYVYiMiFLltQdfRuMSP_Q,1703
|
|
3
|
-
gha_utils/changelog.py,sha256=poWmTWmTYWu7-zwfKKbIlqBQv9qoAJeFhTcZWH9Fl1c,5865
|
|
4
|
-
gha_utils/cli.py,sha256=NlOktO7ddL8fhwkXEB3fVw3Qj-37maWnrYpyL_cKgHw,9202
|
|
5
|
-
gha_utils/mailmap.py,sha256=snSQBn1BDZ21783l4yCkQc3RLIxh5X6QCunFRkDj-24,6301
|
|
6
|
-
gha_utils/metadata.py,sha256=qdhAH-NHPusWIicoN9Js-7idvkcnJa9wzF4mVi7giPY,47203
|
|
7
|
-
gha_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
gha_utils-4.5.2.dist-info/METADATA,sha256=OBVWECS5Kq8WiOKI0S9MxtX4uzy4xHxQIF68BVmql5A,17976
|
|
9
|
-
gha_utils-4.5.2.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
|
10
|
-
gha_utils-4.5.2.dist-info/entry_points.txt,sha256=8bJOwQYf9ZqsLhBR6gUCzvwLNI9f8tiiBrJ3AR0EK4o,54
|
|
11
|
-
gha_utils-4.5.2.dist-info/top_level.txt,sha256=C94Blb61YkkyPBwCdM3J_JPDjWH0lnKa5nGZeZ5M6yE,10
|
|
12
|
-
gha_utils-4.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|