Publish to PyPI #33
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: Publish to PyPI | |
on: | |
workflow_run: | |
workflows: ["Unit Tests"] # The name of the tests workflow | |
types: | |
- completed # This will trigger the workflow when the tests workflow completes | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} # Only run if tests passed | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' # Specify the Python version you want to use | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel twine | |
- name: Build the package | |
run: python setup.py sdist bdist_wheel | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: __token__ # Use the username __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} # Ensure you have this secret set up | |
run: twine upload dist/* |