Skip to content

Commit

Permalink
Add a workflow for making an automatic PyPI release
Browse files Browse the repository at this point in the history
  • Loading branch information
mwydmuch committed Jan 10, 2024
1 parent 3393a61 commit 5febb46
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/pypi-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Upload a new release to PyPI

on:
workflow_dispatch:
push:
branches: [master]
release:
types: [published]

jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Build sdist
run: pipx run build --sdist

- name: Upload sdist
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

upload_pypi:
name: Upload to PyPI
needs: [build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download all dists
uses: actions/download-artifact@v3
with:
# Unpacks default artifact into dist/
# If `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 5febb46

Please sign in to comment.