Skip to content

Commit

Permalink
CI: update the PyPI publishing workflow to use OpenID connection
Browse files Browse the repository at this point in the history
  • Loading branch information
mrakitin committed Jun 6, 2023
1 parent dbab51c commit 86b8367
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@ jobs:
deploy:

runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel twine setuptools
- name: Build and publish
env:
TWINE_USERNAME: __token__
# The PYPI_PASSWORD must be a pypi token with the "pypi-" prefix with sufficient permissions to upload this package
# https://pypi.org/help/#apitoken
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v3

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

- name: Build package
run: |
set -vxeuo pipefail
python -m pip install --upgrade pip
pip install wheel setuptools
python setup.py sdist bdist_wheel
- name: Publish wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist/

0 comments on commit 86b8367

Please sign in to comment.