Configure trusted publishing for PyPI file upload (#137607)

This commit is contained in:
Marc Mueller 2025-02-25 02:05:30 +01:00 committed by GitHub
parent b86bb75e5e
commit 597c0ab985
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -448,6 +448,9 @@ jobs:
environment: ${{ needs.init.outputs.channel }} environment: ${{ needs.init.outputs.channel }}
needs: ["init", "build_base"] needs: ["init", "build_base"]
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
if: github.repository_owner == 'home-assistant' && needs.init.outputs.publish == 'true' if: github.repository_owner == 'home-assistant' && needs.init.outputs.publish == 'true'
steps: steps:
- name: Checkout the repository - name: Checkout the repository
@ -473,16 +476,13 @@ jobs:
run: | run: |
# Remove dist, build, and homeassistant.egg-info # Remove dist, build, and homeassistant.egg-info
# when build locally for testing! # when build locally for testing!
pip install twine build pip install build
python -m build python -m build
- name: Upload package - name: Upload package to PyPI
shell: bash uses: pypa/gh-action-pypi-publish@v1.12.4
run: | with:
export TWINE_USERNAME="__token__" skip-existing: true
export TWINE_PASSWORD="${{ secrets.TWINE_TOKEN }}"
twine upload dist/* --skip-existing
hassfest-image: hassfest-image:
name: Build and test hassfest image name: Build and test hassfest image