Skip to content

docs: update README.rst #140

docs: update README.rst

docs: update README.rst #140

name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
# publish wheels and source to test.pypi.org on releases/* branch
# publish wheels and source to pypi.org when pushing v* tag on master or releasees/* branch
on:
push:
branches:
- master
- releases/*
tags:
- v*
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Set up Python 3.9🐍
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependency
run: python -m pip install -U pip wheel setuptools setuptools_scm[toml] twine build
- name: Build release assets
run: |
python -m build --sdist --wheel
- name: twine check
run: python -m twine check dist/*
- name: Publish distribution 📦 to Test PyPI
if: startsWith(github.event.ref, 'refs/heads/releases/')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}