Skip to content

Build and Publish on PyPI #9

Build and Publish on PyPI

Build and Publish on PyPI #9

name: Build and Publish on PyPI
on:
workflow_run:
workflows: [Release]
types: [completed]
jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Hatch
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Build
run: |
hatch build
- name: Store distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: Publish to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/clifs
permissions:
id-token: write
steps:
- name: Download dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1