diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 1a03a7b..ac3f53e 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,5 +1,5 @@ -# This workflow 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 +# This workflow will upload a Python Package using trusted publishers +# For more information see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ name: Upload Python Package @@ -9,23 +9,27 @@ on: jobs: deploy: - runs-on: ubuntu-latest + permissions: + id-token: write # This is important for OIDC + contents: read # Recommended for checkout + 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 setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + - uses: actions/checkout@v5 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.x' + - name: Install pypa/build + run: | + python -m pip install build --user + - name: Build Package + run: python -m build + - name: Publish to Pypi + uses: pypa/gh-action-pypi-publish@release/v1 + with: + # This action handles building and publishing automatically + # No need to manually run setup.py or twine + # No secrets needed here for PyPI username/password + # The action will use the OIDC token from the permissions block \ No newline at end of file