Version 0.5 #7
Workflow file for this run
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
# This workflow will build and upload a Python Package using Twine | |
name: Upload Python Package to PyPI | |
on: | |
# Trigger automatically when a release is published | |
release: | |
types: [published] | |
# Also permit manual dispatch | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine hatchling | |
- name: Extract version | |
id: get-version | |
run: echo "::set-output name=VERSION::$(python -m hatchling version)" | |
- name: Build package | |
run: python -m build | |
- name: Check package | |
run: twine check --strict dist/* | |
- name: Publish package, only if correctly tagged | |
if: github.ref == format('refs/tags/v{0}', steps.get-version.outputs.VERSION) | |
run: twine upload --non-interactive --verbose --disable-progress-bar dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |