diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 50f0deda1d..b8d28b553f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,8 +19,11 @@ jobs: release: name: Release runs-on: ubuntu-latest + environment: pypi permissions: contents: write # Required to upload release assets + id-token: write # For "Trusted Publisher" to PyPi + if: github.repository_owner == 'home-assistant' steps: - name: Checkout the repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 @@ -46,14 +49,18 @@ jobs: run: ./script/translations_download env: LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }} + - name: Build and release package run: | - python3 -m pip install twine build - export TWINE_USERNAME="__token__" - export TWINE_PASSWORD="${{ secrets.TWINE_TOKEN }}" + python3 -m pip install build export SKIP_FETCH_NIGHTLY_TRANSLATIONS=1 script/release + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 + with: + skip-existing: true + - name: Upload release assets uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 with: diff --git a/script/release b/script/release index 13eaaa4cb2..bdb33dc462 100755 --- a/script/release +++ b/script/release @@ -1,5 +1,4 @@ #!/bin/sh -# Pushes a new version to PyPi. # Stop on errors set -e @@ -12,5 +11,4 @@ yarn install script/build_frontend rm -rf dist home_assistant_frontend.egg-info -python3 -m build -python3 -m twine upload dist/*.whl --skip-existing +python3 -m build -q