feature: use command status to skip next job
This commit is contained in:
@@ -27,8 +27,9 @@ jobs:
|
||||
run: |
|
||||
pip install git-flow-envs=="${{ vars.GITFLOWENVS_VERSION }}"
|
||||
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 "should_build=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
|
||||
+10
-10
@@ -2,7 +2,6 @@ from typing import Optional
|
||||
|
||||
import typer
|
||||
|
||||
import git_flow.command.base as base
|
||||
from git_flow import (
|
||||
COMMIT_TYPE_INCREMENT,
|
||||
SEMVER_MAJOR,
|
||||
@@ -12,13 +11,14 @@ from git_flow import (
|
||||
GitFlowError,
|
||||
)
|
||||
from git_flow.changelog import Changelog
|
||||
from git_flow.command import base
|
||||
from git_flow.git import Git
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
|
||||
@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."""
|
||||
base.ensure_initialized()
|
||||
|
||||
@@ -63,16 +63,17 @@ def tag(token: Optional[str] = None, update_changelog: bool = False):
|
||||
)
|
||||
|
||||
if not next_tag:
|
||||
base.io_error(
|
||||
base.io_warning(
|
||||
"Los cambios realizados no implican un salto de versión, se mantiene la anterior."
|
||||
)
|
||||
return
|
||||
|
||||
raise typer.Exit(code=1)
|
||||
|
||||
if update_changelog:
|
||||
changelog = Changelog()
|
||||
changelog.update(next_tag, commits)
|
||||
Git("add", Changelog.FILENAME).exec(print=None if ci else "Agregando nuevo CHANGELOG.md")
|
||||
Git("commit", message=Changelog.COMMIT_MESSAGE).exec(print=None if ci else "Creando commit")
|
||||
Git("add", Changelog.FILENAME).exec(print="Agregando nuevo CHANGELOG.md")
|
||||
Git("commit", message=Changelog.COMMIT_MESSAGE).exec(print="Creando commit")
|
||||
|
||||
if ci:
|
||||
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()
|
||||
|
||||
if ci:
|
||||
base.get_remote_api(token).create_tag(next_tag, tag_commit)
|
||||
print(next_tag)
|
||||
base.io_success(base.get_remote_api(token).create_tag(next_tag, tag_commit))
|
||||
|
||||
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:
|
||||
return (token, True)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user