Skip to content

Instantly share code, notes, and snippets.

@montudor
Last active September 6, 2019 22:05
Show Gist options
  • Save montudor/88a973be0ea541019446e0ea13311d58 to your computer and use it in GitHub Desktop.
Save montudor/88a973be0ea541019446e0ea13311d58 to your computer and use it in GitHub Desktop.
Upload a Python package to PyPI using GitHub Actions
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/*
@montudor
Copy link
Author

montudor commented Aug 24, 2019

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 and TWINE_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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment