Skip to content

Commit dd6ef71

Browse files
saitcakmakfacebook-github-bot
authored andcommitted
Use trusted publisher for PyPI uploads (#2330)
Summary: [Upgrade to Trusted Publishing](https://github.com/pytorch/botorch/actions/runs/8914483363/job/24484640242#step:9:20) Trusted Publishers allows publishing packages to PyPI from automated environments like GitHub Actions without needing to use username/password combinations or API tokens to authenticate with PyPI. Read more: https://docs.pypi.org/trusted-publishers I set-up the trusted publishers for deploy & nightly workflows on pypi & test-pypi. These will generate temporary tokens for upload originating from these workflows and avoid the need for tokens. Pull Request resolved: #2330 Test Plan: https://github.com/pytorch/botorch/actions/runs/8916612542/job/24488330050 Reviewed By: Balandat Differential Revision: D56861480 Pulled By: saitcakmak fbshipit-source-id: 6a2a5403bae6fcc76a5ac2ae947d73473b8d47e6
1 parent e4e49e8 commit dd6ef71

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/workflows/deploy_on_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
package-deploy-pypi:
1919
name: Package and deploy to pypi.org
2020
runs-on: ubuntu-latest
21+
permissions:
22+
id-token: write # This is required for PyPI OIDC authentication.
2123
needs: tests-and-coverage-pip
2224
steps:
2325
- uses: actions/checkout@v4
@@ -40,8 +42,6 @@ jobs:
4042
- name: Deploy to PyPI
4143
uses: pypa/gh-action-pypi-publish@release/v1
4244
with:
43-
user: __token__
44-
password: ${{ secrets.PYPI_TOKEN }}
4545
verbose: true
4646

4747
package-deploy-conda:

.github/workflows/nightly.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
package-test-deploy-pypi:
1919
name: Package and test deployment to test.pypi.org
2020
runs-on: ubuntu-latest
21+
permissions:
22+
id-token: write # This is required for PyPI OIDC authentication.
2123
steps:
2224
- uses: actions/checkout@v4
2325
- name: Fetch all history for all tags and branches
@@ -54,10 +56,8 @@ jobs:
5456
- name: Deploy to Test PyPI
5557
uses: pypa/gh-action-pypi-publish@release/v1
5658
with:
57-
user: __token__
58-
password: ${{ secrets.TEST_PYPI_TOKEN }}
59-
repository_url: https://test.pypi.org/legacy/
60-
skip_existing: true
59+
repository-url: https://test.pypi.org/legacy/
60+
skip-existing: true
6161
verbose: true
6262

6363
package-conda:

0 commit comments

Comments
 (0)