Skip to content

Publish Python 🐍 distribution πŸ“¦ to PyPI #1

Publish Python 🐍 distribution πŸ“¦ to PyPI

Publish Python 🐍 distribution πŸ“¦ to PyPI #1

Workflow file for this run

name: Publish Python 🐍 distribution πŸ“¦ to PyPI
on:
push:
tags:
- "*"
jobs:
build:
name: Build distribution πŸ“¦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: Build a binary wheel and a source tarball
run: ./build-project.py
- name: Store the distribution packages
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: >-
Publish Python 🐍 distribution πŸ“¦ to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/pip/${{ github.ref_name }}
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution πŸ“¦ to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1