From 98d5c4ab3de0906b6058bde46a597b56329299e8 Mon Sep 17 00:00:00 2001 From: Jonathan Teran Date: Tue, 29 Sep 2026 11:19:46 -0300 Subject: [PATCH] feature: change exit code to 3 when no tag is needed, and skip build / publish in that case --- .gitea/workflows/bump-build-publish.yaml | 12 +++++++++++- bitbucket-pipelines.yml | 14 -------------- src/git_flow/command/tag.py | 7 +++++-- 3 files changed, 16 insertions(+), 17 deletions(-) delete mode 100644 bitbucket-pipelines.yml diff --git a/.gitea/workflows/bump-build-publish.yaml b/.gitea/workflows/bump-build-publish.yaml index e64c20c..cfce0d2 100644 --- a/.gitea/workflows/bump-build-publish.yaml +++ b/.gitea/workflows/bump-build-publish.yaml @@ -22,12 +22,22 @@ jobs: id: version run: | 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 + if: steps.version.outputs.skip != 'true' uses: astral-sh/setup-uv@v8.3.2 - name: Build and publish + if: steps.version.outputs.skip != 'true' run: | uv build uv publish --token="${{ secrets.PYPI_TOKEN }}" diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml deleted file mode 100644 index f88d4bd..0000000 --- a/bitbucket-pipelines.yml +++ /dev/null @@ -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 diff --git a/src/git_flow/command/tag.py b/src/git_flow/command/tag.py index 0d413ec..c477994 100644 --- a/src/git_flow/command/tag.py +++ b/src/git_flow/command/tag.py @@ -14,6 +14,9 @@ from git_flow.git import Git 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() 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() if 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) @@ -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." ) - raise typer.Exit(code=1) + raise typer.Exit(code=EXIT_NO_TAG_NEEDED) if update_changelog: changelog = Changelog()