feature: use command status to skip next job
This commit is contained in:
@@ -27,8 +27,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pip install git-flow-envs=="${{ vars.GITFLOWENVS_VERSION }}"
|
pip install git-flow-envs=="${{ vars.GITFLOWENVS_VERSION }}"
|
||||||
TAG=$(git-flow tag --token="${{ secrets.GITEA_TOKEN }}")
|
TAG=$(git-flow tag --token="${{ secrets.GITEA_TOKEN }}")
|
||||||
|
TAG=force
|
||||||
|
|
||||||
if [ "$TAG" = "" ]; then
|
if [ -z "$TAG" ]; then
|
||||||
echo "No new tag available, skipping next step."
|
echo "No new tag available, skipping next step."
|
||||||
echo "should_build=false" >> $GITHUB_OUTPUT
|
echo "should_build=false" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
|
|||||||
+10
-10
@@ -2,7 +2,6 @@ from typing import Optional
|
|||||||
|
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
import git_flow.command.base as base
|
|
||||||
from git_flow import (
|
from git_flow import (
|
||||||
COMMIT_TYPE_INCREMENT,
|
COMMIT_TYPE_INCREMENT,
|
||||||
SEMVER_MAJOR,
|
SEMVER_MAJOR,
|
||||||
@@ -12,13 +11,14 @@ from git_flow import (
|
|||||||
GitFlowError,
|
GitFlowError,
|
||||||
)
|
)
|
||||||
from git_flow.changelog import Changelog
|
from git_flow.changelog import Changelog
|
||||||
|
from git_flow.command import base
|
||||||
from git_flow.git import Git
|
from git_flow.git import Git
|
||||||
|
|
||||||
app = typer.Typer()
|
app = typer.Typer()
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
def tag(token: Optional[str] = None, update_changelog: bool = False):
|
def tag(token: str | None = None, update_changelog: bool = False):
|
||||||
"""Crea un nuevo tag para el último merge."""
|
"""Crea un nuevo tag para el último merge."""
|
||||||
base.ensure_initialized()
|
base.ensure_initialized()
|
||||||
|
|
||||||
@@ -63,16 +63,17 @@ def tag(token: Optional[str] = None, update_changelog: bool = False):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not next_tag:
|
if not next_tag:
|
||||||
base.io_error(
|
base.io_warning(
|
||||||
"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."
|
||||||
)
|
)
|
||||||
return
|
|
||||||
|
raise typer.Exit(code=1)
|
||||||
|
|
||||||
if update_changelog:
|
if update_changelog:
|
||||||
changelog = Changelog()
|
changelog = Changelog()
|
||||||
changelog.update(next_tag, commits)
|
changelog.update(next_tag, commits)
|
||||||
Git("add", Changelog.FILENAME).exec(print=None if ci else "Agregando nuevo CHANGELOG.md")
|
Git("add", Changelog.FILENAME).exec(print="Agregando nuevo CHANGELOG.md")
|
||||||
Git("commit", message=Changelog.COMMIT_MESSAGE).exec(print=None if ci else "Creando commit")
|
Git("commit", message=Changelog.COMMIT_MESSAGE).exec(print="Creando commit")
|
||||||
|
|
||||||
if ci:
|
if ci:
|
||||||
Git("push").exec()
|
Git("push").exec()
|
||||||
@@ -80,13 +81,12 @@ def tag(token: Optional[str] = None, update_changelog: bool = False):
|
|||||||
tag_commit = Git("show", "HEAD", patch=False, format="%h").firstline()
|
tag_commit = Git("show", "HEAD", patch=False, format="%h").firstline()
|
||||||
|
|
||||||
if ci:
|
if ci:
|
||||||
base.get_remote_api(token).create_tag(next_tag, tag_commit)
|
base.io_success(base.get_remote_api(token).create_tag(next_tag, tag_commit))
|
||||||
print(next_tag)
|
|
||||||
|
|
||||||
Git("tag", next_tag, tag_commit).exec(print=None if ci else "Creando tag localmente")
|
Git("tag", next_tag, tag_commit).exec(print="Creando tag localmente")
|
||||||
|
|
||||||
|
|
||||||
def get_token_and_ci(token: Optional[str]):
|
def get_token_and_ci(token: str | None):
|
||||||
if token:
|
if token:
|
||||||
return (token, True)
|
return (token, True)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user