publishing to pypi
.github/workflows/python-publish.yml, name Build and publish python package.
on:
release:
types: [ published ]
workflow_dispatch:
flowchart TD Rel["GitHub release published"] --> Job["ubuntu-latest"] Disp["workflow_dispatch"] --> Job Job --> Py["setup-python 3.12"] Py --> Po["pip install poetry && poetry install"] Po --> Tok["poetry config pypi-token.pypi"] Tok --> Pub["poetry publish --build"]
Job#
actions/checkout@v4actions/setup-python@v5withpython-version: '3.12'pip install poetrythenpoetry installpoetry config pypi-token.pypi ${{ secrets.PYPI_API_KEY }}poetry publish --build
Permissions: contents: write. The publish job does not run tests.
Local publish#
poetry build
poetry config pypi-token.pypi <token>
poetry publish
Package name on PyPI is pyjiit. Users: pip install pyjiit.
Checklist#
- Version is
0.1.0a8(or the next one) inpyproject.toml,pyjiit/init.py,docs/conf.py. README.rstis the long description.- Runtime deps still
requestsandpycryptodomeonly. - You meant to ship an alpha (
a8).
flowchart LR Toml["pyproject.toml"] --> Sdist["sdist"] Toml --> Wheel["wheel"] Sdist --> PyPI Wheel --> PyPI