ci: publish: use trusted publishing

This commit is contained in:
Willi Ballenthin
2023-07-10 01:57:42 +02:00
parent 506d677684
commit cb289e3fc5

View File

@@ -1,6 +1,5 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# use PyPI trusted publishing, as described here:
# https://blog.trailofbits.com/2023/05/23/trusted-publishing-a-new-benchmark-for-packaging-security/
name: publish to pypi
on:
@@ -8,8 +7,12 @@ on:
types: [published]
jobs:
deploy:
runs-on: ubuntu-20.04
pypi-publish:
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Set up Python
@@ -19,11 +22,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
pip install setuptools wheel
- name: build package
run: |
python setup.py sdist bdist_wheel
twine upload --skip-existing dist/*
- name: publish package
uses: pypa/gh-action-pypi-publish@release/v1