Skip to content

Commit

Permalink
Automate releasing to PyPI
Browse files Browse the repository at this point in the history
Take advantage of trusted publishers to avoid dealing with
authentication.
https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/
  • Loading branch information
francoisfreitag committed Jul 23, 2023
1 parent 67fae02 commit 4b27e4d
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Upload release to PyPI
on:
release:
types: [published]

jobs:
build:
name: Build distribution files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install dependencies
run: pip install --user build setuptools twine wheel

- name: Build package
run: python -m build

- name: Verify package
run: twine check --strict dist/*

- name: Upload distributions to GitHub
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
if-no-files-found: error

release:
name: Send distribution files to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi-release
url: https://pypi.org/p/django-auth-ldap
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 4b27e4d

Please sign in to comment.