Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move building a release and uploading to PyPI to GitHub actions
- Loading branch information
1 parent
b3b3dad
commit 46d9662
Showing
4 changed files
with
59 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters