Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. GitHub Actions
  3. Publish a Python distribution package to PyPI

Publish a Python distribution package to PyPI

BSD-3-ClausePythonv1.14.0

A GitHub Action for securely publishing Python packages to PyPI using trusted publishing (OIDC) without requiring API tokens.

Visit WebsiteGitHubGitHub
1.2k stars111 forks0 contributors

What is Publish a Python distribution package to PyPI?

PyPI publish GitHub Action is an official GitHub Action for securely uploading Python distribution packages to the Python Package Index (PyPI) from CI/CD workflows. It solves the problem of automating package releases without managing sensitive API tokens by using PyPI's trusted publishing (OIDC) feature.

Target Audience

Python package maintainers and developers who use GitHub Actions for CI/CD and want to automate publishing to PyPI or other Python package repositories securely.

Value Proposition

Developers choose this action because it's the official PyPA solution, offers tokenless authentication via trusted publishing, includes built-in security best practices, and simplifies release automation with minimal configuration.

Overview

The blessed :octocat: GitHub Action, for publishing your :package: distribution files to PyPI, the tokenless way: https://github.com/marketplace/actions/pypi-publish

Use Cases

Best For

  • Automating Python package releases to PyPI from GitHub Actions
  • Implementing secure, tokenless authentication using PyPI's trusted publishing
  • Generating and uploading digital attestations for package provenance
  • Publishing to multiple indices like PyPI and TestPyPI in separate jobs
  • Enforcing security best practices by separating build and publish stages
  • Debugging upload issues with verbose output and hash verification

Not Ideal For

  • Projects using Windows or macOS GitHub Actions runners
  • Teams wanting to integrate publishing into reusable workflows
  • Developers seeking a single-job build and publish solution
  • Users of custom containerized jobs in CI/CD

Pros & Cons

Pros

Tokenless OIDC Authentication

Uses PyPI's trusted publishing via OpenID Connect, eliminating the need to manage and store API tokens, as highlighted in the trusted publishing setup.

Automatic Digital Attestations

Generates and uploads Sigstore-signed attestations by default for trusted publishing flows, enhancing package provenance and security without extra configuration.

Security-First Job Separation

Enforces building and publishing in separate jobs to prevent privilege escalation and build dependency poisoning, a core philosophy stated in the non-goals section.

Flexible Index Support

Supports PyPI, TestPyPI, and custom repositories with configurable URLs, allowing for diverse publishing targets as shown in the advanced release management examples.

Cons

Linux-Only Constraint

The action is docker-based and only supported in GNU/Linux jobs, explicitly unsupported for other runner OSes, limiting cross-platform CI/CD setups.

Complex Workflow Orchestration

Requires manual setup of artifact sharing between separate build and publish jobs using actions like upload/download-artifact, adding overhead for simple projects.

Unsupported Workflow Patterns

Cannot be used in reusable workflows or composite actions with trusted publishing, and invoking it multiple times in one job is not supported, restricting CI/CD modularity.

Frequently Asked Questions

Quick Stats

Stars1,164
Forks111
Contributors0
Open Issues26
Last commit25 days ago
CreatedSince 2019

Tags

#pypi#upload#release#devops#workflow#python-packaging#workflow-automation#openid-connect#github-action#package-publishing#secrets#python#ci-cd#github-actions

Built With

D
Docker

Links & Resources

Website

Included in

GitHub Actions27.6k
Auto-fetched 1 day ago

Related Projects

Executing remote ssh commandsExecuting remote ssh commands

GitHub Actions for executing remote ssh commands.

Stars6,074
Forks674
Last commit3 days ago
FTP Deploy Action, Deploys a GitHub project to a FTP server using GitHub actionsFTP Deploy Action, Deploys a GitHub project to a FTP server using GitHub actions

Deploys a GitHub project to a FTP server using GitHub actions

Stars4,944
Forks430
Last commit9 days ago
Copy files and artifacts via SSHCopy files and artifacts via SSH

GitHub Action that copy files and artifacts via SSH.

Stars1,548
Forks173
Last commit1 month ago
GitHub Action for GoReleaser, a release automation tool for Go projectsGitHub Action for GoReleaser, a release automation tool for Go projects

GitHub Action for GoReleaser

Stars995
Forks98
Last commit12 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub