Skip to content

Workflow file for this run

name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
on:
push:
tags:
- '*'
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build distribution
run: python -m build
- name: Upload built distributions
uses: actions/upload-artifact@v2
with:
name: python-package-distributions
path: dist/
pypi-publish:
name: Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download built distributions
uses: actions/download-artifact@v2
with:
name: python-package-distributions
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
repository_url: https://upload.pypi.org/legacy/
packages_dir: dist
verify_metadata: true
skip_existing: false
verbose: false
print_hash: false