Skip to content

Commit aceed23

Browse files
committed
cicd added
1 parent a002387 commit aceed23

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

.github/workflows/CICD.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*" # Se ejecuta cuando haces push de un tag que comience con 'v'
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
build-and-publish:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Check out the repository
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.9"
22+
23+
- name: Install build dependencies
24+
run: |
25+
pip install --upgrade pip
26+
pip install setuptools wheel twine build
27+
28+
- name: Extract version from setup.py
29+
id: get_version
30+
run: |
31+
# Busca en setup.py la línea que tenga VERSION = "X.Y.Z"
32+
# y extrae el valor X.Y.Z
33+
VERSION=$(grep -Po '(?<=^VERSION = ")[^"]*' setup.py)
34+
echo "package_version=$VERSION" >> $GITHUB_OUTPUT
35+
36+
# (Opcional) Paso para comprobar que el tag vX.Y.Z coincide con la versión del setup.py
37+
- name: Check version consistency
38+
if: startsWith(github.ref, 'refs/tags/')
39+
run: |
40+
TAG_VERSION="${GITHUB_REF#refs/tags/v}" # quita el prefijo 'v'
41+
if [ "$TAG_VERSION" != "${{ steps.get_version.outputs.package_version }}" ]; then
42+
echo "Error: la versión del tag ($TAG_VERSION) no coincide con setup.py (${{ steps.get_version.outputs.package_version }})"
43+
exit 1
44+
fi
45+
46+
- name: Build distribution (sdist & wheel)
47+
run: |
48+
python -m build
49+
50+
- name: Publish to PyPI
51+
run: |
52+
twine check dist/*
53+
twine upload --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} dist/*

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
from setuptools import setup, find_packages
44

5-
VERSION = "4.0.120"
5+
VERSION = "4.0.12"
66
# Descripción breve basada en el .csproj
77
DESCRIPTION = "Genera facturas CFDI válidas ante el SAT consumiendo el API de https://www.fiscalapi.com"
88

0 commit comments

Comments
 (0)