Skip to content

GitHub action to automate build and publish PEP 518 compliant projects (Setuptools, Flit, Poetry) on Test PyPI and/or PyPI if local package.__version__ is ahead of PyPI’s.

License

Notifications You must be signed in to change notification settings

AlirezaTheH/pypi-auto-publish

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

PyPI Auto Publish

GitHub action to automate build and publish PEP 518 compliant projects (Setuptools, Flit, Poetry) on Test PyPI and/or PyPI if local package.__version__ is ahead of PyPI's.

Usage

name: Publish
on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  pypi-publish:
    runs-on: ubuntu-latest
    steps:
      - uses: alirezatheh/pypi-auto-publish@v1
        with:
          test-api-pypi-token: ${{ secrets.TEST_PYPI_API_TOKEN }}
          pypi-api-token: ${{ secrets.PYPI_API_TOKEN }}

The action assume:

  • The project has a setup.py, setup.cfg or pyproject.toml in the top-level directory.
  • Python and pip are installed (e.g. by actions/setup-python@v3).

Inputs

  • test-api-pypi-token: API token of the Test PyPI account publishing the project. If missing, publish on Test PyPI is skipped (optional).
  • pypi-api-token: API token of the PyPI account publishing the project (required).
  • package-name: Name of the PyPI package, Defaults to repository name (optional).

Acknowledgements

This action is inspired by pypi-auto-publish

About

GitHub action to automate build and publish PEP 518 compliant projects (Setuptools, Flit, Poetry) on Test PyPI and/or PyPI if local package.__version__ is ahead of PyPI’s.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages