diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index a86ff64..4b2f943 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -7,7 +7,7 @@ on: types: [created] jobs: - deploy: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -15,12 +15,27 @@ jobs: - 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