Upload Python Package #4
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: workflow_dispatch | |
permissions: | |
contents: read | |
id-token: write # Allow GitHub to mint tokens | |
jobs: | |
pypi-publish: | |
name: Upload release to PyPI | |
runs-on: ubuntu-latest # Can use macos-latest if needed | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install setuptools | |
pip install twine | |
pip install wheel | |
sudo apt-get install jq | |
- name: Clean previous builds | |
run: rm -rf dist | |
- name: Build package | |
run: python setup.py sdist bdist_wheel | |
- name: Publish package to PyPI | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: twine upload --repository-url https://upload.pypi.org/legacy/ dist/* |