diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..8b3d46f --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,66 @@ +name: Publicar paquete PyPI + +on: + push: + branches: ["7.0"] + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + test -n "$GITEA_TOKEN" || { echo "Missing GITEA_TOKEN secret"; exit 1; } + git init . + git remote add origin http://unpaismejor-gitea-app:3000/tryton-do/ncf_manager.git + git -c http.extraHeader="Authorization: token $GITEA_TOKEN" \ + fetch --depth=1 origin 7.0 + git checkout --detach FETCH_HEAD + + - name: Verificar Python + run: python3 --version + + - name: Instalar herramientas + run: | + python3 -m venv .ci-venv + .ci-venv/bin/python -m pip install --upgrade \ + "setuptools>=68,<81" "wheel>=0.41,<1" "twine>=6,<7" + + - name: Comprobar credenciales + env: + TWINE_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + run: test -n "$TWINE_PASSWORD" || { echo "Missing REGISTRY_PASSWORD secret"; exit 1; } + + - name: Fijar versión CI + env: + PACKAGE_VERSION: 7.0.${{ gitea.run_number }} + run: | + .ci-venv/bin/python - <<'PY' + from pathlib import Path + import os, re + path = Path('tryton.cfg') + text = path.read_text() + path.write_text(re.sub(r'(?m)^version=.*$', + f"version={os.environ['PACKAGE_VERSION']}", text)) + PY + + - name: Construir y validar + run: | + .ci-venv/bin/python setup.py sdist bdist_wheel + .ci-venv/bin/python -m twine check dist/* + + - name: Publicar en Gitea PyPI + env: + TWINE_USERNAME: unpaismejor + TWINE_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + run: | + .ci-venv/bin/python -m twine upload --non-interactive \ + --repository-url https://code.unpaismejor.org.do/api/packages/tryton-do/pypi \ + dist/* diff --git a/doc/index.rst b/doc/index.rst index 2c7869b..6323916 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -12,7 +12,7 @@ Installing Install the package and activate the module in the database:: - pip install solutema_ncf_manager + pip install unpaismejor_ncf_manager trytond-admin -d -u ncf_manager Publishing diff --git a/setup.py b/setup.py index a8e6e3e..69041d2 100755 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ version = info.get('version', '0.0.1') major_version, minor_version, _ = version.split('.', 2) major_version = int(major_version) minor_version = int(minor_version) -name = 'solutema_ncf_manager' +name = 'unpaismejor_ncf_manager' local_version = [] if os.environ.get('CI_JOB_ID'):