Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically publish to PyPI #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Upload a Python package when a release is created
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows

name: Publish Python 🐍 distributions 📦 to PyPI

on:
release:
types: [released]

jobs:
build-n-publish:
runs-on: ubuntu-latest
permissions:
id-token: write # for trusted publishing

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4

- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
Comment on lines +20 to +23
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can skip this as the package uses a static version in the metadata.


- name: Build a source tarball and a binary wheel
# https://pypa-build.readthedocs.io
run: |
python -m pip install build
python -m build

- name: Publish 📦 to PyPI
# https://github.com/pypa/gh-action-pypi-publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true