tinysemver 3.0.1__tar.gz → 3.0.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinysemver
3
- Version: 3.0.1
3
+ Version: 3.0.2
4
4
  Summary: Semantic-Versioning... that doesn't need 300,000 lines of JS
5
5
  Author-email: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>
6
6
  License: Apache License
@@ -403,6 +403,7 @@ To enable it, add `push-moving-tags: 'true'` and ensure your token has force-pus
403
403
 
404
404
  When enabled, TinySemVer creates three tags: `v3` (major), `v3.0` (minor), and `v3.0.0` (specific).
405
405
  The default `GITHUB_TOKEN` typically lacks force-push permissions for protected branches.
406
+ If a moving tag can't be pushed, TinySemVer prints a warning and keeps going — by that point the version commit and the exact tag are already published, so the aliases must never abort a completed release.
406
407
 
407
408
  ### Security Considerations
408
409
 
@@ -164,6 +164,7 @@ To enable it, add `push-moving-tags: 'true'` and ensure your token has force-pus
164
164
 
165
165
  When enabled, TinySemVer creates three tags: `v3` (major), `v3.0` (minor), and `v3.0.0` (specific).
166
166
  The default `GITHUB_TOKEN` typically lacks force-push permissions for protected branches.
167
+ If a moving tag can't be pushed, TinySemVer prints a warning and keeps going — by that point the version commit and the exact tag are already published, so the aliases must never abort a completed release.
167
168
 
168
169
  ### Security Considerations
169
170
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tinysemver"
7
- version = "3.0.1"
7
+ version = "3.0.2"
8
8
  description = "Semantic-Versioning... that doesn't need 300,000 lines of JS"
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -92,9 +92,22 @@ def print_to_console(message: str) -> None:
92
92
 
93
93
 
94
94
  def get_last_tag(repository_path: PathLike) -> str:
95
- """Retrieve the last Git tag name from the repository."""
95
+ """Retrieve the last full-version Git tag name from the repository.
96
+
97
+ Only three-component tags count: the moving `v3` and `v3.0` aliases that `push_moving_tags`
98
+ maintains point at the same commits as real releases and must never be mistaken for one.
99
+ """
96
100
  result = subprocess.run(
97
- ["git", "describe", "--tags", "--abbrev=0"],
101
+ [
102
+ "git",
103
+ "describe",
104
+ "--tags",
105
+ "--abbrev=0",
106
+ "--match",
107
+ "v[0-9]*.[0-9]*.[0-9]*",
108
+ "--match",
109
+ "[0-9]*.[0-9]*.[0-9]*",
110
+ ],
98
111
  stdout=subprocess.PIPE,
99
112
  stderr=subprocess.PIPE,
100
113
  cwd=repository_path,
@@ -310,32 +323,21 @@ def create_tag(
310
323
 
311
324
  print_to_console(f"[bold green]Pushed tag:[/bold green] {tag}")
312
325
 
313
- # Optionally force-push the moving major and minor version tags
326
+ # Optionally force-push the moving major and minor version tags. By this point the version
327
+ # commit and the exact tag are already on the remote, so the release is complete and cannot
328
+ # be retried - a token without force-push rights must cost the aliases, never the release.
314
329
  if push_moving_tags:
315
- major_tag = f"v{version[0]}"
316
- minor_tag = f"v{version[0]}.{version[1]}"
317
-
318
- # Force-push the major version tag (e.g., v2)
319
- push_result = subprocess.run(
320
- ["git", "push", url, major_tag, "--force"], cwd=repository_path, capture_output=True, env=env
321
- )
322
- if push_result.returncode != 0:
323
- raise RuntimeError(
324
- f"Failed to push major tag '{major_tag}' to the remote repository: '{url}' with error: {push_result.stderr.decode('utf-8')}"
330
+ for moving_tag in (f"v{version[0]}", f"v{version[0]}.{version[1]}"):
331
+ push_result = subprocess.run(
332
+ ["git", "push", url, moving_tag, "--force"], cwd=repository_path, capture_output=True, env=env
325
333
  )
326
-
327
- # Force-push the minor version tag (e.g., v2.1)
328
- push_result = subprocess.run(
329
- ["git", "push", url, minor_tag, "--force"], cwd=repository_path, capture_output=True, env=env
330
- )
331
- if push_result.returncode != 0:
332
- raise RuntimeError(
333
- f"Failed to push minor tag '{minor_tag}' to the remote repository: '{url}' with error: {push_result.stderr.decode('utf-8')}"
334
- )
335
-
336
- print_to_console(f"[bold green]Pushed moving tags:[/bold green]")
337
- print_to_console(f"[bold green] - Major:[/bold green] {major_tag}")
338
- print_to_console(f"[bold green] - Minor:[/bold green] {minor_tag}")
334
+ if push_result.returncode != 0:
335
+ print_to_console(
336
+ f"[bold yellow]Warning:[/bold yellow] couldn't force-push moving tag '{moving_tag}': "
337
+ f"{push_result.stderr.decode('utf-8').strip()} - the release itself is complete"
338
+ )
339
+ else:
340
+ print_to_console(f"[bold green]Pushed moving tag:[/bold green] {moving_tag} -> {tag}")
339
341
 
340
342
  # Create a release using GitHub CLI if available
341
343
  if create_release and github_repository:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinysemver
3
- Version: 3.0.1
3
+ Version: 3.0.2
4
4
  Summary: Semantic-Versioning... that doesn't need 300,000 lines of JS
5
5
  Author-email: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>
6
6
  License: Apache License
@@ -403,6 +403,7 @@ To enable it, add `push-moving-tags: 'true'` and ensure your token has force-pus
403
403
 
404
404
  When enabled, TinySemVer creates three tags: `v3` (major), `v3.0` (minor), and `v3.0.0` (specific).
405
405
  The default `GITHUB_TOKEN` typically lacks force-push permissions for protected branches.
406
+ If a moving tag can't be pushed, TinySemVer prints a warning and keeps going — by that point the version commit and the exact tag are already published, so the aliases must never abort a completed release.
406
407
 
407
408
  ### Security Considerations
408
409
 
File without changes
File without changes