Skip to content

Create python-publish.yml #1

Create python-publish.yml

Create python-publish.yml #1

# GitHub Actions Workflow: Python Publish
# Description: Automates testing, building, and publishing the Python package to PyPI.
name: Python Package Publish
on:
push:
branches:
- main
- master
tags:
- 'v*.*.*'
jobs:
build-and-publish:
name: Build and Publish Python Package
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}