Skip to content

Upload Python Package to PyPi #5

Upload Python Package to PyPi

Upload Python Package to PyPi #5

Workflow file for this run

# This workflow will upload a Python Package using Hatch when a release is created.
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
name: "Upload Python Package to PyPi"
on:
release:
types: [published]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Get the source code
- uses: actions/checkout@v3
# Install a recent version of Python
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
# Install the build dependencies (we use hatch)
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
# Use hatch to build the package (sdist and wheel files)
- name: Build package
run: hatch build
# Use the official PyPa GH Action to publish the release
# (we could also use hatch directly with a `run` command, but the Action
# is cleaner and safer.)
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}