python-semantic-release 9.4.2__py3-none-any.whl → 9.5.0__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.
- {python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/METADATA +2 -2
- {python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/RECORD +9 -9
- semantic_release/__init__.py +1 -1
- semantic_release/hvcs/github.py +95 -16
- {python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/AUTHORS.rst +0 -0
- {python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/LICENSE +0 -0
- {python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/WHEEL +0 -0
- {python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/entry_points.txt +0 -0
- {python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/top_level.txt +0 -0
{python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-semantic-release
|
|
3
|
-
Version: 9.
|
|
3
|
+
Version: 9.5.0
|
|
4
4
|
Summary: Automatic Semantic Versioning for Python projects
|
|
5
5
|
Author-email: Rolf Erik Lekang <me@rolflekang.com>
|
|
6
6
|
License: MIT
|
|
@@ -35,7 +35,7 @@ Requires-Dist: shellingham ~=1.5
|
|
|
35
35
|
Provides-Extra: dev
|
|
36
36
|
Requires-Dist: pre-commit ~=3.5 ; extra == 'dev'
|
|
37
37
|
Requires-Dist: tox ~=4.11 ; extra == 'dev'
|
|
38
|
-
Requires-Dist: ruff ==0.
|
|
38
|
+
Requires-Dist: ruff ==0.4.1 ; extra == 'dev'
|
|
39
39
|
Provides-Extra: docs
|
|
40
40
|
Requires-Dist: Sphinx ~=6.0 ; extra == 'docs'
|
|
41
41
|
Requires-Dist: sphinxcontrib-apidoc ==0.5.0 ; extra == 'docs'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
semantic_release/__init__.py,sha256=
|
|
1
|
+
semantic_release/__init__.py,sha256=OKGFjDLUMtF4yJFzPOCIxLjmnv_T7QJWrmqcCinoIDA,870
|
|
2
2
|
semantic_release/__main__.py,sha256=vXOARLV7KHeVXgpOMU0Q-8wovpdsOrtTsycxulI5xIE,106
|
|
3
3
|
semantic_release/const.py,sha256=Z1o2QNh60wSLeF-_1TemMBjU3ZXbV0XghnUFsbTVfOs,831
|
|
4
4
|
semantic_release/enums.py,sha256=D5B_reQGGKQQT22HO5PUtvn2Bok3fkht6TfJtXkmAUg,1020
|
|
@@ -36,7 +36,7 @@ semantic_release/hvcs/__init__.py,sha256=ulesZslSG4Lu8Iz3YzOrPXpdgvgbADq_MV17B-b
|
|
|
36
36
|
semantic_release/hvcs/_base.py,sha256=qjjlU3rI-sOhIY_FfXsZ9OQGthNYxgzpL4PhlGSXEuA,5232
|
|
37
37
|
semantic_release/hvcs/bitbucket.py,sha256=6vGOcRG7WexxG8SzLcWDIzp7zNpB0ruDLUTQ9GE2jGM,11004
|
|
38
38
|
semantic_release/hvcs/gitea.py,sha256=OTThBTZ93xUP9am7tNIE0UVchhJwG9ASvI6zuiG8oLE,11450
|
|
39
|
-
semantic_release/hvcs/github.py,sha256=
|
|
39
|
+
semantic_release/hvcs/github.py,sha256=DI0fK_dhVAzwd6S80zZMMVIAsz-b0zTGca-SMVJIUyE,19965
|
|
40
40
|
semantic_release/hvcs/gitlab.py,sha256=qmowL22DCNOFa7RwmMTmNmno3BS0dyNYT9L36ujgZ8A,7409
|
|
41
41
|
semantic_release/hvcs/token_auth.py,sha256=ZjT56-NIPB4OKIt1qwHCu1TavXnrWFIBl9ARlg56hgU,663
|
|
42
42
|
semantic_release/hvcs/util.py,sha256=PNKXApgL2np9lpnKjAbo77toRgElLPXrbS1q7621waI,2886
|
|
@@ -45,10 +45,10 @@ semantic_release/version/algorithm.py,sha256=-9ulTy1z4u-jUvbc-FrvEdFL7Omc3O3HhaP
|
|
|
45
45
|
semantic_release/version/declaration.py,sha256=f6Ld7hIhrqvDrRBapJHr-KDimuyo-4IG8009Zu9BIgU,7357
|
|
46
46
|
semantic_release/version/translator.py,sha256=P1noIsVBn8u6zNOFjG0xKYOWapxqf_PHSMvMeLJ9kXg,3050
|
|
47
47
|
semantic_release/version/version.py,sha256=6PCtSbLP88U1daoxnCwHc--YguZo4waGNLqJ5JfeczE,14175
|
|
48
|
-
python_semantic_release-9.
|
|
49
|
-
python_semantic_release-9.
|
|
50
|
-
python_semantic_release-9.
|
|
51
|
-
python_semantic_release-9.
|
|
52
|
-
python_semantic_release-9.
|
|
53
|
-
python_semantic_release-9.
|
|
54
|
-
python_semantic_release-9.
|
|
48
|
+
python_semantic_release-9.5.0.dist-info/AUTHORS.rst,sha256=XOReVvpymEFUPsS2QPH97jlfJBVrxwS2eu8-jVAe4gk,230
|
|
49
|
+
python_semantic_release-9.5.0.dist-info/LICENSE,sha256=NE85nszX252sdQdu0xgS9qwfYES0k8qS6gW3uO4jRGE,1083
|
|
50
|
+
python_semantic_release-9.5.0.dist-info/METADATA,sha256=7RR8GcLU8LGCvbkMVyzcxDjom5Fz8xP4lxLMDi8rHLM,5335
|
|
51
|
+
python_semantic_release-9.5.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
52
|
+
python_semantic_release-9.5.0.dist-info/entry_points.txt,sha256=qojUBx_Ywf4u7KgP6NWlDaBDymZVUGQ7m5wF2duC2F0,95
|
|
53
|
+
python_semantic_release-9.5.0.dist-info/top_level.txt,sha256=qYA24nyg3eP-ti5UW7Vuj2aXVmM0wqVHx4mREdRZNAA,17
|
|
54
|
+
python_semantic_release-9.5.0.dist-info/RECORD,,
|
semantic_release/__init__.py
CHANGED
semantic_release/hvcs/github.py
CHANGED
|
@@ -50,18 +50,28 @@ class Github(HvcsBase):
|
|
|
50
50
|
GitHub HVCS interface for interacting with GitHub repositories
|
|
51
51
|
|
|
52
52
|
This class supports the following products:
|
|
53
|
+
|
|
53
54
|
- GitHub Free, Pro, & Team
|
|
54
55
|
- GitHub Enterprise Cloud
|
|
55
|
-
|
|
56
|
-
This class does not support the following products:
|
|
57
56
|
- GitHub Enterprise Server (on-premises installations)
|
|
57
|
+
|
|
58
|
+
This interface does its best to detect which product is configured based
|
|
59
|
+
on the provided domain. If it is the official `github.com`, the default
|
|
60
|
+
domain, then it is considered as GitHub Enterprise Cloud which uses the
|
|
61
|
+
subdomain `api.github.com` for api communication.
|
|
62
|
+
|
|
63
|
+
If the provided domain is anything else, than it is assumed to be communicating
|
|
64
|
+
with an on-premise or 3rd-party maintained GitHub instance which matches with
|
|
65
|
+
the GitHub Enterprise Server product. The on-prem server product uses a
|
|
66
|
+
path prefix for handling api requests which is configured to be
|
|
67
|
+
`server.domain/api/v3` based on the documentation in April 2024.
|
|
58
68
|
"""
|
|
59
69
|
|
|
60
|
-
# TODO: Add support for GitHub Enterprise Server (on-premises installations)
|
|
61
|
-
# DEFAULT_ONPREM_API_PATH = "/api/v3"
|
|
62
70
|
DEFAULT_DOMAIN = "github.com"
|
|
63
71
|
DEFAULT_API_SUBDOMAIN_PREFIX = "api"
|
|
64
72
|
DEFAULT_API_DOMAIN = f"{DEFAULT_API_SUBDOMAIN_PREFIX}.{DEFAULT_DOMAIN}"
|
|
73
|
+
DEFAULT_API_PATH_CLOUD = "/" # no path prefix!
|
|
74
|
+
DEFAULT_API_PATH_ONPREM = "/api/v3"
|
|
65
75
|
DEFAULT_ENV_TOKEN_NAME = "GH_TOKEN" # noqa: S105
|
|
66
76
|
|
|
67
77
|
def __init__(
|
|
@@ -117,10 +127,15 @@ class Github(HvcsBase):
|
|
|
117
127
|
# infer from Domain url and prepend the default api subdomain
|
|
118
128
|
**{
|
|
119
129
|
**self.hvcs_domain._asdict(),
|
|
120
|
-
"host":
|
|
121
|
-
"path":
|
|
130
|
+
"host": self.hvcs_domain.host,
|
|
131
|
+
"path": str(
|
|
132
|
+
PurePosixPath(
|
|
133
|
+
str.lstrip(self.hvcs_domain.path or "", "/") or "/",
|
|
134
|
+
self.DEFAULT_API_PATH_ONPREM.lstrip("/"),
|
|
135
|
+
)
|
|
136
|
+
),
|
|
122
137
|
}
|
|
123
|
-
).url
|
|
138
|
+
).url.rstrip("/")
|
|
124
139
|
)
|
|
125
140
|
|
|
126
141
|
if api_domain_parts.scheme == "http" and not allow_insecure:
|
|
@@ -138,16 +153,66 @@ class Github(HvcsBase):
|
|
|
138
153
|
"Only http and https are supported."
|
|
139
154
|
)
|
|
140
155
|
|
|
141
|
-
#
|
|
142
|
-
|
|
156
|
+
# As GitHub Enterprise Cloud and GitHub Enterprise Server (on-prem) have different api locations
|
|
157
|
+
# lets check what we have been given and set the api url accordingly
|
|
158
|
+
# NOTE: Github Server (on premise) uses a path prefix '/api/v3' for the api
|
|
159
|
+
# while GitHub Enterprise Cloud uses a separate subdomain as the base
|
|
160
|
+
is_github_cloud = bool(self.hvcs_domain.url == f"https://{self.DEFAULT_DOMAIN}")
|
|
161
|
+
|
|
162
|
+
# Calculate out the api url that we expect for GitHub Cloud
|
|
163
|
+
default_cloud_api_url = parse_url(
|
|
143
164
|
Url(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
165
|
+
# set api domain and append the default api path
|
|
166
|
+
**{
|
|
167
|
+
**self.hvcs_domain._asdict(),
|
|
168
|
+
"host": f"{self.DEFAULT_API_DOMAIN}",
|
|
169
|
+
"path": self.DEFAULT_API_PATH_CLOUD,
|
|
170
|
+
}
|
|
148
171
|
).url.rstrip("/")
|
|
149
172
|
)
|
|
150
173
|
|
|
174
|
+
if (
|
|
175
|
+
is_github_cloud
|
|
176
|
+
and hvcs_api_domain
|
|
177
|
+
and api_domain_parts.url not in default_cloud_api_url.url
|
|
178
|
+
):
|
|
179
|
+
# Api was provied but is not a subset of the expected one, raise an error
|
|
180
|
+
# we check for a subset because the user may not have provided the full api path
|
|
181
|
+
# but the correct domain. If they didn't, then we are erroring out here.
|
|
182
|
+
raise ValueError(
|
|
183
|
+
f"Invalid api domain {api_domain_parts.url} for GitHub Enterprise Cloud. "
|
|
184
|
+
f"Expected {default_cloud_api_url.url}."
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
# Set the api url to the default cloud one if we are on cloud, otherwise
|
|
188
|
+
# use the verified api domain for a on-prem server
|
|
189
|
+
self.api_url = (
|
|
190
|
+
default_cloud_api_url
|
|
191
|
+
if is_github_cloud
|
|
192
|
+
else parse_url(
|
|
193
|
+
# Strip any auth, query or fragment from the domain
|
|
194
|
+
Url(
|
|
195
|
+
scheme=api_domain_parts.scheme,
|
|
196
|
+
host=api_domain_parts.host,
|
|
197
|
+
port=api_domain_parts.port,
|
|
198
|
+
path=str(
|
|
199
|
+
PurePosixPath(
|
|
200
|
+
# pass any custom server prefix path but ensure we don't
|
|
201
|
+
# double up the api path in the case the user provided it
|
|
202
|
+
str.replace(
|
|
203
|
+
api_domain_parts.path or "",
|
|
204
|
+
self.DEFAULT_API_PATH_ONPREM,
|
|
205
|
+
"",
|
|
206
|
+
).lstrip("/")
|
|
207
|
+
or "/",
|
|
208
|
+
# apply the on-prem api path
|
|
209
|
+
self.DEFAULT_API_PATH_ONPREM.lstrip("/"),
|
|
210
|
+
)
|
|
211
|
+
),
|
|
212
|
+
).url.rstrip("/")
|
|
213
|
+
)
|
|
214
|
+
)
|
|
215
|
+
|
|
151
216
|
@lru_cache(maxsize=1)
|
|
152
217
|
def _get_repository_owner_and_name(self) -> tuple[str, str]:
|
|
153
218
|
# Github actions context
|
|
@@ -419,7 +484,7 @@ class Github(HvcsBase):
|
|
|
419
484
|
lambda x: x[1] is not None,
|
|
420
485
|
{
|
|
421
486
|
"auth": auth,
|
|
422
|
-
"path": str(PurePosixPath("/", path)),
|
|
487
|
+
"path": str(PurePosixPath("/", path.lstrip("/"))),
|
|
423
488
|
"query": query,
|
|
424
489
|
"fragment": fragment,
|
|
425
490
|
}.items(),
|
|
@@ -439,7 +504,14 @@ class Github(HvcsBase):
|
|
|
439
504
|
query: str | None = None,
|
|
440
505
|
fragment: str | None = None,
|
|
441
506
|
) -> str:
|
|
442
|
-
|
|
507
|
+
# Ensure any path prefix is transfered but not doubled up on the derived url
|
|
508
|
+
return self._derive_url(
|
|
509
|
+
self.hvcs_domain,
|
|
510
|
+
path=f"{self.hvcs_domain.path or ''}/{path.lstrip(self.hvcs_domain.path)}",
|
|
511
|
+
auth=auth,
|
|
512
|
+
query=query,
|
|
513
|
+
fragment=fragment,
|
|
514
|
+
)
|
|
443
515
|
|
|
444
516
|
def create_api_url(
|
|
445
517
|
self,
|
|
@@ -448,4 +520,11 @@ class Github(HvcsBase):
|
|
|
448
520
|
query: str | None = None,
|
|
449
521
|
fragment: str | None = None,
|
|
450
522
|
) -> str:
|
|
451
|
-
|
|
523
|
+
# Ensure any api path prefix is transfered but not doubled up on the derived api url
|
|
524
|
+
return self._derive_url(
|
|
525
|
+
self.api_url,
|
|
526
|
+
path=f"{self.api_url.path or ''}/{endpoint.lstrip(self.api_url.path)}",
|
|
527
|
+
auth=auth,
|
|
528
|
+
query=query,
|
|
529
|
+
fragment=fragment,
|
|
530
|
+
)
|
{python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/AUTHORS.rst
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{python_semantic_release-9.4.2.dist-info → python_semantic_release-9.5.0.dist-info}/top_level.txt
RENAMED
|
File without changes
|