Use CI post version for Gitea package uploads

This commit is contained in:
José Arturo García
2026-07-22 19:30:47 -04:00
parent f448205978
commit 9374457c57
2 changed files with 34 additions and 4 deletions
+28 -1
View File
@@ -24,6 +24,26 @@ jobs:
python -m pip install --upgrade pip
python -m pip install build twine
- name: Set CI package version
run: |
python - <<'PY'
from pathlib import Path
import os
import re
path = Path('tryton.cfg')
text = path.read_text()
match = re.search(r'(?m)^version=(.+)$', text)
if not match:
raise SystemExit('tryton.cfg has no version entry')
base_version = match.group(1).strip()
run_number = os.environ.get('GITHUB_RUN_NUMBER', '0')
ci_version = f'{base_version}.post{run_number}'
text = re.sub(r'(?m)^version=.+$', f'version={ci_version}', text)
path.write_text(text)
print(f'Package version: {ci_version}')
PY
- name: Build package
run: |
python -m build
@@ -32,12 +52,19 @@ jobs:
run: |
python -m twine check dist/*
- name: Check publishing credentials
env:
TWINE_USERNAME: ${{ secrets.GITEA_PACKAGE_USER }}
TWINE_PASSWORD: ${{ secrets.GITEA_PACKAGE_TOKEN }}
run: |
test -n "$TWINE_USERNAME" || { echo "Missing GITEA_PACKAGE_USER secret"; exit 1; }
test -n "$TWINE_PASSWORD" || { echo "Missing GITEA_PACKAGE_TOKEN secret"; exit 1; }
- name: Publish to Gitea PyPI registry
env:
TWINE_USERNAME: ${{ secrets.GITEA_PACKAGE_USER }}
TWINE_PASSWORD: ${{ secrets.GITEA_PACKAGE_TOKEN }}
run: |
python -m twine upload \
--skip-existing \
--repository-url https://gitea.joseagrc.com/api/packages/tryton-do/pypi \
dist/*