Files
ncf_manager/.gitea/workflows/publish.yml
T
2026-08-16 14:12:26 -04:00

64 lines
1.8 KiB
YAML

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 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: |
python3 - <<'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: |
python3 -m build
python3 -m twine check dist/*
- name: Publicar en Gitea PyPI
env:
TWINE_USERNAME: unpaismejor
TWINE_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: |
python3 -m twine upload --non-interactive \
--repository-url https://code.unpaismejor.org.do/api/packages/tryton-do/pypi \
dist/*