Last active
September 6, 2019 22:05
-
-
Save montudor/88a973be0ea541019446e0ea13311d58 to your computer and use it in GitHub Desktop.
Upload a Python package to PyPI using GitHub Actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload Python Package | |
on: | |
release: | |
types: [created] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PyPI & GitHub Actions
This is just a simple configuration file that allows you to deploy your Python package to PyPI when you create a new release on GitHub.
How to setup
Set your
TWINE_USERNAME
andTWINE_PASSWORD
(your PyPI username and password) in your GitHub repository secrets.After this, just place this file in your
.github/workflows
folder and you'll be ready to go!This is now a starter workflow, see actions/starter-workflows#69.