Switch the Publish Release workflow to use OpenID Connect (#6012)

This commit is contained in:
Jakub Kuczys 2023-04-16 22:53:27 +02:00 committed by GitHub
parent c2da29c93e
commit 64c72e79b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,28 +53,53 @@ jobs:
echo 'Continuing...'
fi
release_to_pypi:
needs: release_information
environment: Release
name: Release to PyPI
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
python -m build
twine upload dist/*
python -m pip install --upgrade build twine
- name: Build
run: python -m build
- name: Check built distributions
run: python -m twine check dist/*
- name: Upload packaged distributions
uses: actions/upload-artifact@v3
with:
path: ./dist
release_to_pypi:
needs:
- release_information
- build
environment: Release
name: Release to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download packaged distributions
uses: actions/download-artifact@v3
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# This is already checked during the build.
verify-metadata: false
# Allow security-minded people to verify whether the files on PyPI
# were automatically uploaded by a CI script.
print-hash: true
pr_dev_bump:
permissions: