Skip to content

Commit

Permalink
Merge pull request #376 from jstockwin/pypi-trusted-publisher
Browse files Browse the repository at this point in the history
Change release to use PyPI Trusted Publisher
  • Loading branch information
jstockwin authored Aug 7, 2023
2 parents 32aa7f3 + cd172bd commit aff6950
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,30 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@master
- name: Install build packages
run: pip3 install twine==3.1.1 wheel==0.34.2
- name: Build package
run: python3 setup.py sdist bdist_wheel
- name: Check built package
run: twine check dist/*
- name: Publish package to PyPI
run: twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
- uses: actions/checkout@v3
- uses: actions/setup-python@master
- name: Install build packages
run: pip3 install twine==3.1.1 wheel==0.34.2
- name: Build package
run: python3 setup.py sdist bdist_wheel
- name: Check built package
run: twine check dist/*
- uses: actions/upload-artifact@v3
with:
path: ./dist

pypi-publish:
needs: ["build"]
environment: "pypi"

name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v3
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: artifact/

0 comments on commit aff6950

Please sign in to comment.