feat(release): streamline PyPI publishing process
All checks were successful
Python Package CI/CD / Setup and Test (push) Successful in 1m17s
Python Package CI/CD / Publish to PyPI (push) Successful in 39s

Simplified the publishing to PyPI steps in the release workflow by consolidating the Python environment setup, tool installation, package building, and publishing into a single job. This change makes the workflow more efficient and reduces the number of steps required to publish a package. It ensures that the environment setup, dependencies installation, package building, and publishing are done in one go, which can help in minimizing potential issues arising from multiple, separate steps.

This approach leverages the existing Python and PyPI tools more effectively and could potentially shorten the release cycle time. It also makes the workflow file cleaner and easier to maintain.
This commit is contained in:
Kumi 2024-04-15 19:22:07 +02:00
parent 9110910b11
commit 66d4dff72d
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -43,21 +43,12 @@ jobs:
apt update apt update
apt install -y python3 python3-venv apt install -y python3 python3-venv
- name: Set up Python environment - name: Publish to PyPI
run: | run: |
python3 -m venv venv python3 -m venv venv
. ./venv/bin/activate . ./venv/bin/activate
- name: Install publishing tools
run: |
pip install -U hatchling twine build pip install -U hatchling twine build
- name: Build the package
run: |
python -m build . python -m build .
- name: Publish the package to PyPI
run: |
python -m twine upload --username __token__ --password ${PYPI_TOKEN} dist/* python -m twine upload --username __token__ --password ${PYPI_TOKEN} dist/*
env: env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}