67 lines
2.0 KiB
YAML
67 lines
2.0 KiB
YAML
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/*
|