Skip to content

Commit

Permalink
Move building a release and uploading to PyPI to GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisfreitag committed Jul 22, 2023
1 parent b3b3dad commit 46d9662
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 45 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,33 @@
name: Build distribution files

on:
release:
types: [published]

jobs:
test:
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 package to GitHub
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
if-no-files-found: error
34 changes: 0 additions & 34 deletions .github/workflows/packaging.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,26 @@
name: Upload release to PyPI
on:
workflow_run:
workflows: [Build distribution files]
types: [completed]

jobs:
on-success:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment:
name: Publish to PyPI
url: https://pypi.org/p/django-auth-ldap
permissions:
id-token: write
steps:
- name: Retrieve artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
11 changes: 0 additions & 11 deletions tox.ini
Expand Up @@ -41,14 +41,3 @@ deps =
commands =
make -C docs html
allowlist_externals = make

[testenv:packaging]
deps =
build
setuptools
twine
wheel
skip_install = true
commands =
python -m build
twine check --strict dist/*

0 comments on commit 46d9662

Please sign in to comment.