63 lines
1.7 KiB
YAML
63 lines
1.7 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
|
|
uses: https://gitea.com/actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITEA_TOKEN }}
|
|
github-server-url: http://unpaismejor-gitea-app:3000
|
|
ref: 8.0
|
|
fetch-depth: 0
|
|
|
|
- name: Configurar Python
|
|
uses: https://gitea.com/actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Instalar herramientas
|
|
run: 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: |
|
|
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: |
|
|
python -m build
|
|
python -m twine check dist/*
|
|
|
|
- name: Publicar en Gitea PyPI
|
|
env:
|
|
TWINE_USERNAME: unpaismejor
|
|
TWINE_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
|
run: |
|
|
python -m twine upload --non-interactive \
|
|
--repository-url https://code.unpaismejor.org.do/api/packages/tryton-do/pypi \
|
|
dist/*
|