Compare commits

...
8 Commits
Author SHA1 Message Date
jt 14ec438fa1 Merge pull request 'feature: change exit code to 3 when no tag is needed, and skip build / publish in that case' (#71) from feature/no-tag-different-exit-code into main
Publish to PyPI / Bump-Build-Publish (push) Successful in 43s
Reviewed-on: #71
2026-09-29 14:26:22 +00:00
Jonathan Teran 98d5c4ab3d feature: change exit code to 3 when no tag is needed, and skip build / publish in that case 2026-09-29 11:19:46 -03:00
jt 5cff0e4484 Merge pull request 'bugfix: only abort merge when is needed' (#70) from bugfix/abort-merge-when-necessary into main
Publish to PyPI / Bump-Build-Publish (push) Successful in 22s
Reviewed-on: #70
2026-09-28 17:35:38 +00:00
jt 61712b0872 bugfix: only abort merge when is needed 2026-09-28 14:35:10 -03:00
jt 98f71d5481 Merge pull request 'bugfix: commit small improvements' (#69) from bugfix/commit-small-improvements into main
Publish to PyPI / Bump-Build-Publish (push) Successful in 45s
Reviewed-on: #69
2026-09-28 17:27:53 +00:00
jt d54c740748 Merge pull request 'Bugfix/missing click module' (#68) from bugfix/missing-click-module into main
Publish to PyPI / Bump-Build-Publish (push) Successful in 44s
Reviewed-on: #68
2026-09-28 13:04:28 +00:00
jt 86a2768c81 bugfix: remove import click and supress typer errors only 2026-09-28 10:03:39 -03:00
jt 9dee43705a clean: delete test csv 2026-09-28 09:57:30 -03:00
7 changed files with 25 additions and 22 deletions
+11 -1
View File
@@ -22,12 +22,22 @@ jobs:
id: version id: version
run: | run: |
pip install git-flow-envs=="${{ vars.GITFLOWENVS_VERSION }}" pip install git-flow-envs=="${{ vars.GITFLOWENVS_VERSION }}"
git-flow tag --token="${{ secrets.GITEA_TOKEN }}" # El código 3 indica que no hace falta un nuevo tag: se saltea la publicación
status=0
git-flow tag --token="${{ secrets.GITEA_TOKEN }}" || status=$?
if [ "$status" -eq 3 ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
elif [ "$status" -ne 0 ]; then
exit "$status"
fi
- name: Install uv - name: Install uv
if: steps.version.outputs.skip != 'true'
uses: astral-sh/setup-uv@v8.3.2 uses: astral-sh/setup-uv@v8.3.2
- name: Build and publish - name: Build and publish
if: steps.version.outputs.skip != 'true'
run: | run: |
uv build uv build
uv publish --token="${{ secrets.PYPI_TOKEN }}" uv publish --token="${{ secrets.PYPI_TOKEN }}"
-14
View File
@@ -1,14 +0,0 @@
image: python:3.10
pipelines:
branches:
'main':
- step:
name: "Tag and publish package"
caches:
- pip
script:
- pip install uv
- uv run git-flow tag --token=$BEARER
- uv build
- uv publish --token=$PYPI_TOKEN
-2
View File
@@ -1,2 +0,0 @@
name,commit sha,author,date
worktree-kind-watching-hearth,e8c0c0b777d31fa94cd3f01fbf9c68b165d77015,Jonathan Teran Carballo,2026-09-13T23:18:47-03:00
1 name commit sha author date
2 worktree-kind-watching-hearth e8c0c0b777d31fa94cd3f01fbf9c68b165d77015 Jonathan Teran Carballo 2026-09-13T23:18:47-03:00
+3 -1
View File
@@ -79,7 +79,9 @@ def check_merge_conflicts(target: str):
print="Realizando merge de prueba para verificar conflictos" print="Realizando merge de prueba para verificar conflictos"
) )
Git("merge", abort=True).exec(print="Abortando merge de prueba", check=False) # Si el merge no llegó a realizarse (por ejemplo, "Already up to date") no hay nada que abortar
if Git.is_merging():
Git("merge", abort=True).exec(print="Abortando merge de prueba")
if merge_conflicts: if merge_conflicts:
base.io_error( base.io_error(
+5 -2
View File
@@ -14,6 +14,9 @@ from git_flow.git import Git
app = typer.Typer() app = typer.Typer()
# Código de salida cuando no hace falta crear un tag, para que el CI pueda saltear la publicación
EXIT_NO_TAG_NEEDED = 3
@app.command() @app.command()
def tag(target: str | None = None, token: str | None = None, update_changelog: bool = False): def tag(target: str | None = None, token: str | None = None, update_changelog: bool = False):
@@ -35,7 +38,7 @@ def tag(target: str | None = None, token: str | None = None, update_changelog: b
merge_commit_tag = Git("tag", "--points-at", merge_commit).firstline() merge_commit_tag = Git("tag", "--points-at", merge_commit).firstline()
if merge_commit_tag: if merge_commit_tag:
base.io_info(f"El último merge ya tiene un tag: {merge_commit_tag}") base.io_info(f"El último merge ya tiene un tag: {merge_commit_tag}")
return raise typer.Exit(code=EXIT_NO_TAG_NEEDED)
token, ci = get_token_and_ci(token) token, ci = get_token_and_ci(token)
@@ -97,7 +100,7 @@ def tag(target: str | None = None, token: str | None = None, update_changelog: b
"Los cambios realizados no implican un salto de versión, se mantiene la anterior." "Los cambios realizados no implican un salto de versión, se mantiene la anterior."
) )
raise typer.Exit(code=1) raise typer.Exit(code=EXIT_NO_TAG_NEEDED)
if update_changelog: if update_changelog:
changelog = Changelog() changelog = Changelog()
+5
View File
@@ -63,6 +63,11 @@ class Git:
def get_branches(prefix: str = ""): def get_branches(prefix: str = ""):
return Git._get_references("heads/" + prefix) return Git._get_references("heads/" + prefix)
@staticmethod
def is_merging() -> bool:
"""Indica si hay un merge en curso (existe MERGE_HEAD), con o sin conflictos."""
return Git("rev-parse", "MERGE_HEAD", quiet=True, verify=True).code() == 0
@staticmethod @staticmethod
def status(): def status():
return list(map(Git.Status, Git("status", porcelain=True).lines(False))) return list(map(Git.Status, Git("status", porcelain=True).lines(False)))
+1 -2
View File
@@ -3,7 +3,6 @@
from subprocess import CalledProcessError, SubprocessError from subprocess import CalledProcessError, SubprocessError
from typing import Annotated from typing import Annotated
import click
import typer import typer
from rich.markup import escape from rich.markup import escape
from rich.traceback import Traceback from rich.traceback import Traceback
@@ -70,7 +69,7 @@ def _print_error(message: str, title: str, e: BaseException):
base.io_error(message, title=title) base.io_error(message, title=title)
console.print( console.print(
Traceback.from_exception( Traceback.from_exception(
type(e), e, e.__traceback__, suppress=[click, typer] type(e), e, e.__traceback__, suppress=[typer]
) )
) )
else: else: