diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index afe421e9..a6e85313 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -17,6 +17,9 @@ jobs: if: github.repository == 'browserbase/sdk-python' environment: release runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -26,8 +29,8 @@ jobs: with: version: '0.9.13' - - name: Publish to PyPI - run: | - bash ./bin/publish-pypi - env: - PYPI_TOKEN: ${{ secrets.BROWSERBASE_PYPI_TOKEN || secrets.PYPI_TOKEN }} + - name: Build + run: uv build + + # Trusted publishing (OIDC) with attestations; no stored PyPI token. + - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 32cc46c8..b77d60ca 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -20,4 +20,3 @@ jobs: env: STLC_BOT_APP_ID: ${{ secrets.STLC_BOT_APP_ID }} STLC_BOT_PRIVATE_KEY: ${{ secrets.STLC_BOT_PRIVATE_KEY }} - PYPI_TOKEN: ${{ secrets.BROWSERBASE_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4fdd0cee..9f6fb32b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -119,9 +119,4 @@ the changes aren't made through the automated pipeline, you may want to make rel ### Publish with a GitHub workflow -You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/browserbase/sdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. - -### Publish manually - -If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on -the environment. +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/browserbase/sdk-python/actions/workflows/publish-pypi.yml). It publishes through PyPI trusted publishing and needs a `release` environment approval; there is no manual publish path. diff --git a/bin/check-release-environment b/bin/check-release-environment index 584d2a63..5e9d64b3 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -8,10 +8,6 @@ if [ -z "${STLC_BOT_APP_ID}" ] || [ -z "${STLC_BOT_PRIVATE_KEY}" ]; then errors+=("The STLC_BOT_APP_ID / STLC_BOT_PRIVATE_KEY secrets are not set. Releases mint tokens from the browserbase-stlc-bot GitHub App; check the org secrets' repository access.") fi -if [ -z "${PYPI_TOKEN}" ]; then - errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") -fi - lenErrors=${#errors[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi deleted file mode 100644 index e72ca2fa..00000000 --- a/bin/publish-pypi +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -eux -rm -rf dist -mkdir -p dist -uv build -uv publish --token=$PYPI_TOKEN