Files
certbot-dns-netbox/.gitea/workflows/publish.yml
T
Sven Luthi 73fe0a7bad
Publish Python package to PyPI / publish (push) Canceled after 0s
new file: .gitea/workflows/publish.yml
new file:   .gitignore
new file:   LICENSE
modified:   pyproject.toml
2026-10-26 18:48:38 +01:00

45 lines
1.1 KiB
YAML

name: Publish Python package to PyPI
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: https://github.com/actions/checkout@v4
- name: Set up Python
uses: https://github.com/actions/setup-python@v5
with:
python-version: "3.x"
- name: Verify tag matches package version
run: |
TAG="${GITHUB_REF_NAME}"
VERSION="$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")"
if [ "$TAG" != "v$VERSION" ]; then
echo "::error::Tag ${TAG} does not match package version v${VERSION}"
exit 1
fi
- name: Install build tools
run: python -m pip install --upgrade build twine
- name: Build package
run: python -m build
- name: Check package
run: python -m twine check dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_NON_INTERACTIVE: "1"
run: python -m twine upload dist/*