Compare commits
22
Commits
v1.22.3
...
45fe22aea7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45fe22aea7 | ||
|
|
c194b555c3 | ||
|
|
60c29b6aa5 | ||
|
|
488e9172cb | ||
|
|
c23a890f8e | ||
|
|
dd79b478e2 | ||
|
|
0a143909f5 | ||
|
|
6a44b20556 | ||
|
|
cc816b4244 | ||
|
|
8ff91e9c45 | ||
|
|
865c39e4f2 | ||
|
|
f14c77e144 | ||
|
|
01631cfddd | ||
|
|
ad76e13673 | ||
|
|
d054881f3e | ||
|
|
ab3023acb7 | ||
|
|
aa63815cc6 | ||
|
|
9ef3100871 | ||
|
|
201e2b54a6 | ||
|
|
a5e50b8b16 | ||
|
|
df09810806 | ||
|
|
e44cd98696 |
@@ -5,13 +5,11 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Publish-to-PyPI:
|
Bump-Build-Publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Configure git
|
- name: Configure git
|
||||||
run: |
|
run: |
|
||||||
@@ -19,7 +17,7 @@ jobs:
|
|||||||
git config --global user.email "actions@git.jonathanteran.dev"
|
git config --global user.email "actions@git.jonathanteran.dev"
|
||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
|
||||||
- name: "Set up Python"
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version-file: ".python-version"
|
python-version-file: ".python-version"
|
||||||
@@ -27,11 +25,23 @@ jobs:
|
|||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v8.3.2
|
uses: astral-sh/setup-uv@v8.3.2
|
||||||
|
|
||||||
- name: Bump version
|
- name: Install git-flow and bump version
|
||||||
|
id: version
|
||||||
run: |
|
run: |
|
||||||
|
# pip install git-flow-envs=="${{ vars.GITFLOWENVS_VERSION }}"
|
||||||
uv run git-flow tag --token="${{ secrets.GITEA_TOKEN }}"
|
uv run git-flow tag --token="${{ secrets.GITEA_TOKEN }}"
|
||||||
|
TAG=force
|
||||||
|
|
||||||
|
if [ -z "$TAG" ]; then
|
||||||
|
echo "No new tag available, skipping next step."
|
||||||
|
echo "should_build=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "New tag available: $TAG."
|
||||||
|
echo "should_build=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Build and publish
|
- name: Build and publish
|
||||||
|
if: steps.version.outputs.should_build == 'true'
|
||||||
run: |
|
run: |
|
||||||
uv build
|
uv build
|
||||||
uv publish --token="${{ secrets.PYPI_TOKEN }}"
|
uv publish --token="${{ secrets.PYPI_TOKEN }}"
|
||||||
+20
-16
@@ -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):
|
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()
|
||||||
|
|
||||||
@@ -62,29 +62,33 @@ def tag(token: Optional[str] = None):
|
|||||||
[c.subject for c in commits], suffix, current_tag
|
[c.subject for c in commits], suffix, current_tag
|
||||||
)
|
)
|
||||||
|
|
||||||
|
base.io_info(f"Current tag: {current_tag}. Next tag: {next_tag}")
|
||||||
|
|
||||||
if not next_tag:
|
if not next_tag:
|
||||||
if not ci:
|
base.io_warning(
|
||||||
base.io_info(
|
"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
|
|
||||||
|
|
||||||
changelog = Changelog()
|
raise typer.Exit(code=1)
|
||||||
|
|
||||||
|
if update_changelog:
|
||||||
|
changelog = Changelog()
|
||||||
|
changelog.update(next_tag, commits)
|
||||||
|
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()
|
||||||
|
|
||||||
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")
|
|
||||||
tag_commit = Git("show", "HEAD", patch=False, format="%h").firstline()
|
tag_commit = Git("show", "HEAD", patch=False, format="%h").firstline()
|
||||||
|
|
||||||
if ci:
|
if ci:
|
||||||
Git("push").exec()
|
base.io_success(base.get_remote_api(token).create_tag(next_tag, tag_commit))
|
||||||
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