name: Publicar paquete PyPI on: push: branches: ["8.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 8.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 \ "build>=1,<2" "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: 8.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 -m build .ci-venv/bin/python -m twine check dist/* .ci-venv/bin/python tools/check_wheel.py - 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/*