Kumi
66d4dff72d
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.
54 lines
1.1 KiB
YAML
54 lines
1.1 KiB
YAML
name: Python Package CI/CD
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup and Test
|
|
container:
|
|
image: node:20-bookworm
|
|
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
apt update
|
|
apt install -y python3 python3-venv
|
|
|
|
- name: Set up Python environment
|
|
run: |
|
|
python3 -V
|
|
python3 -m venv venv
|
|
. ./venv/bin/activate
|
|
pip install -U pip
|
|
pip install .[all]
|
|
|
|
publish:
|
|
name: Publish to PyPI
|
|
container:
|
|
image: node:20-bookworm
|
|
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
apt update
|
|
apt install -y python3 python3-venv
|
|
|
|
- name: Publish to PyPI
|
|
run: |
|
|
python3 -m venv venv
|
|
. ./venv/bin/activate
|
|
pip install -U hatchling twine build
|
|
python -m build .
|
|
python -m twine upload --username __token__ --password ${PYPI_TOKEN} dist/*
|
|
env:
|
|
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|