Skip to content

Commit

Permalink
Implement pypi trusted publishing workflow (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
znerol authored Nov 5, 2023
1 parent eef2b3d commit 3c5cebd
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,35 @@ on:
types: [created]

jobs:
deploy:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --yes python3-wheel twine
sudo apt-get install --yes python3-build python3-wheel
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Build
run: |
python3 setup.py sdist bdist_wheel
twine upload dist/*
python3 -m build
- uses: actions/upload-artifact@v3
with:
path: ./dist

pypi-publish:
needs: ['build']
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/prometheus-pve-exporter/
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

0 comments on commit 3c5cebd

Please sign in to comment.