A Github Action to build and publish your Python package to PyPI or any other repository. Supports any Python version you'll give it (that is also supported by pyenv).
In order for the Action to have access to the code, you must use the actions/checkout@master
job before it. See the example below.
- Login credentials for the package repo (as specified by twine). So, for example:
TWINE_USERNAME
=scott
TWINE_PASSWORD
=tiger
etc.
This would also be where you'd setTWINE_REPOSITORY_URL
if publishing to something other than PyPI.
python_version
: a Python version that is supported by pyenv. For example:3.7.0
.pip_version
(optional): the pip version to use (defaults to newest), some packages may require different pip versions.subdir
(optional): if yoursetup.py
(and therefore, your entire package) is in a subdirectory of your repo, put the path to it here. This will just change the working directory to theSUBDIR
before running the rest of the script.
name: publish-pypi
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Publish Python Package
uses: mariamrf/py-package-publish-action@v1.0.0
with:
python_version: '3.6.0'
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}