Skip to content

Publishes a python repo to a GitHub hosted PyPI. Best used with Bitovi's static PyPI to GitHub Pages action.

License

Notifications You must be signed in to change notification settings

bitovi/github-actions-publish-github-pypi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Publish to GitHub PyPI

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.

Table of Contents

  1. Action Summary
  2. Pre-requisites
  3. Basic Use
  4. Inputs
  5. Contributing
  6. License
  7. Provided by Bitovi
  8. We want to hear from you

Action Summary

This action publishes a Python package to a GitHub-hosted PyPI repository (a repository managed by the handler action):

  1. Extract details from pyproject.toml file
  2. 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

Need help or have questions?

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.

Pre-requisites

  • 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

Basic Use

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 the pyproject.toml file.

Inputs

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

Contributing

We would love for you to contribute to this action. Issues and Pull Requests are welcome!

License

The scripts and documentation in this project are released under the MIT License.

Provided by Bitovi

Bitovi is a proud supporter of Open Source software.

We want to hear from you.

Come chat with us about open source in our Bitovi community Discord!

About

Publishes a python repo to a GitHub hosted PyPI. Best used with Bitovi's static PyPI to GitHub Pages action.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published