This action publishes a Python package to a GitHub-hosted PyPI repository. It extracts details from the pyproject.toml
file and triggers a workflow in the PyPI repository to publish the package.
Note: This is one of two actions that work together to publish a Python package to a GitHub-hosted PyPI repository. The other action is the handler that you need to add to the PyPI repository.
- Action Summary
- Pre-requisites
- Basic Use
- Inputs
- Contributing
- License
- Provided by Bitovi
- We want to hear from you
This action publishes a Python package to a GitHub-hosted PyPI repository (a repository managed by the handler action):
- Extract details from
pyproject.toml
file - Trigger a workflow in the PyPI repository
If you would like to deploy other types of applications, check out our other actions:
Action | Purpose |
---|---|
Deploy Docker to EC2 | Deploys a repo with a Dockerized application to a virtual machine (EC2) on AWS |
Deploy Storybook to GitHub Pages | Builds and deploys a Storybook application to GitHub Pages. |
Deploy static site to AWS (S3/CDN/R53) | Hosts a static site in AWS S3 with CloudFront |
And more!, check our list of actions in the GitHub marketplace
This project is supported by Bitovi, A DevOps consultancy.
You can get help or ask questions on our:
Or, you can hire us for training, consulting, or development. Set up a free consultation.
- A GitHub-hosted PyPI repository with a workflow that uses the corresponding handler action (e.g.
publish-handler.yaml
). To set this up, follow the instructions in the handler action - A GitHub repository with a Python package
- A
pyproject.toml
file in the root of the repository - A GitHub token with
repo
scope added to the repository secrets
For basic usage, create .github/workflows/publish.yaml
with the following to build and publish on push to a tag:
on:
push:
tags:
- 'v*.*.*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Publish to PyPI
uses: bitovi/github-actions-publish-github-pypi@v0.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pypi-github-org: 'your-github-org'
pypi-github-repo: 'your-pypi-repo'
pypi-github-workflow-filename: 'publish-handler.yaml'
Important Note: The values for your release tag should match the value of the
version
key in thepyproject.toml
file.
The following inputs can be used as step.with
keys:
Name | Type | Description |
---|---|---|
pypi-github-org |
String | (Required) The GitHub organization of the PyPI repository |
pypi-github-repo |
String | (Required) The GitHub repository for the PyPI package |
github-token |
String | (Required) The GitHub token to use for triggering the publish workflow in the PyPI repository |
pypi-github-user |
String | (Optional) The GitHub user to publish the package. Default is pypi-publisher[bot] |
pypi-github-workflow-filename |
String | (Optional) The GitHub workflow filename to trigger. Default is publish-trigger.yaml |
pypi-github-workflow-ref |
String | (Optional) The GitHub branch or ref to use when triggering the workflow. Default is main |
checkout |
Boolean | (Optional) Whether to checkout the repository. Default is true |
python-version |
String | (Required) The Python version to use. Default is 3.8 |
toml-file |
String | (Optional) Path to the pyproject.toml file. Default is pyproject.toml |
We would love for you to contribute to this action. Issues and Pull Requests are welcome!
The scripts and documentation in this project are released under the MIT License.
Bitovi is a proud supporter of Open Source software.
Come chat with us about open source in our Bitovi community Discord!