Skip to content

Upload your Python package to PyPI with latest Github version tag.

License

Notifications You must be signed in to change notification settings

PabloLec/pypi-github-sync

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pypi-github-sync GitHub release (latest by date) GitHub

This action allows you to upload your Python package to PyPI automatically using latest GitHub version tag as release version.

How does it work?

Running a Docker container, this action will clone your repo, fetch its latest release tag, modify setup.py and/or pyproject.toml, build and finally push to PyPI.

Also, with current procedure your GitHub repo remains untouched. That means the version parameter in your setup file will not be modified and its value does not matter.
You can leave a dummy value, for example:

setup(
    version="0.0.0",
    ...
)

Usage

In your GitHub repo, create a workflow file or append to an existing one. (e.g. .github/workflows/release.yml)

Mandatory parameters are:

- name: pypi-github-sync
  uses: PabloLec/[email protected]
  with:
    github_repo: YOUR_USERNAME/YOUR_REPO
    twine_username: ${{ secrets.TWINE_USERNAME }}
    twine_password: ${{ secrets.TWINE_PASSWORD }}

You will need to change YOUR_USERNAME and YOUR_REPO values and set your PyPI username and password in your repository secrets (See the docs for reference).

↪️ See EXAMPLE.yml for a real world example.

Inputs

github_repo mandatory

Your github repository with format USERNAME/REPO as in URLs. For example this repo is PabloLec/pypi-github-sync.

twine_username mandatory

Your PyPI username, add TWINE_USERNAME to your repository secrets.

twine_password mandatory

Your PyPI password, add TWINE_PASSWORD to your repository secrets.

upload_repo optional

The repository used for package uploading. Defaults to main PyPI repo, you can use others like PyPI test repo with https://test.pypi.org/legacy/.

verify_metadata optional

Verify build metadata before publication, defaults to false.

skip_existing optional

Do not raise an error if version already exists on repo, defaults to false.

verbose optional

Verbose output for twine upload, defaults to false.

Contributing

Any contribution is welcome.
To report a bug or offer your help, simply open a new issue.
You can also open an issue if you want a new feature to be implemented.