Skip to content

Commit a5ec752

Browse files
authored
[release 0.8] Cherry pick. Use oidc for wheel upload (#1294) (#1296)
* Use oidc for wheel upload * remove aws keys
1 parent 05519a2 commit a5ec752

File tree

4 files changed

+21
-35
lines changed

4 files changed

+21
-35
lines changed

.github/workflows/_build_test_upload.yml

+17-7
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ on:
1717
default: true
1818
type: boolean
1919
secrets:
20-
PYTORCH_BINARY_AWS_ACCESS_KEY_ID:
21-
required: true
22-
PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY:
23-
required: true
2420
PYPI_TOKEN:
2521
required: false
2622
CONDA_PYTORCHBOT_TOKEN:
@@ -30,6 +26,10 @@ on:
3026
CONDA_NIGHTLY_PYTORCHBOT_TOKEN:
3127
required: false
3228

29+
permissions:
30+
id-token: write
31+
contents: read
32+
3333
jobs:
3434
get_release_type:
3535
runs-on: ubuntu-latest
@@ -158,6 +158,19 @@ jobs:
158158
outputs:
159159
upload: ${{ steps.trigger_upload.outputs.value }}
160160
steps:
161+
- name: Configure aws credentials (pytorch account)
162+
if: ${{ needs.get_release_type.outputs.type == 'nightly' }}
163+
uses: aws-actions/configure-aws-credentials@v3
164+
with:
165+
role-to-assume: arn:aws:iam::749337293305:role/gha_workflow_nightly_build_wheels
166+
aws-region: us-east-1
167+
168+
- name: Configure aws credentials (pytorch account)
169+
if: ${{ needs.get_release_type.outputs.type == 'test' }}
170+
uses: aws-actions/configure-aws-credentials@v3
171+
with:
172+
role-to-assume: arn:aws:iam::749337293305:role/gha_workflow_test_build_wheels
173+
aws-region: us-east-1
161174
- name: Download Artifacts from Github
162175
continue-on-error: true
163176
uses: actions/download-artifact@v3
@@ -177,9 +190,6 @@ jobs:
177190
run: ls -lh torchdata*.whl
178191
- name: Upload Wheels to S3 Storage
179192
if: steps.trigger_upload.outputs.value == 'true'
180-
env:
181-
AWS_ACCESS_KEY_ID: ${{ secrets.PYTORCH_BINARY_AWS_ACCESS_KEY_ID }}
182-
AWS_SECRET_ACCESS_KEY: ${{ secrets.PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY }}
183193
run: |
184194
if [[ ${{ inputs.branch }} == 'main' ]]; then
185195
S3_PATH=s3://pytorch/whl/nightly/

.github/workflows/pull_release.yml

-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@ jobs:
1717
pytorch_version: ""
1818
do-upload: false
1919
secrets:
20-
PYTORCH_BINARY_AWS_ACCESS_KEY_ID: ""
21-
PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY: ""
2220
CONDA_TEST_PYTORCHBOT_TOKEN: ""

.github/workflows/release.yml

-24
This file was deleted.

.github/workflows/test_release.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ on:
2222
# env:
2323
# RELEASE_BRANCH: ""
2424

25+
permissions:
26+
id-token: write
27+
contents: read
28+
2529
jobs:
2630
build_test_upload:
2731
if: github.repository == 'pytorch/data' && startsWith(github.ref_name, 'release/')
@@ -31,6 +35,4 @@ jobs:
3135
pre_dev_release: true
3236
pytorch_version: "2.4.0"
3337
secrets:
34-
PYTORCH_BINARY_AWS_ACCESS_KEY_ID: ${{ secrets.PYTORCH_BINARY_AWS_ACCESS_KEY_ID }}
35-
PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY: ${{ secrets.PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY }}
3638
CONDA_TEST_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_TEST_PYTORCHBOT_TOKEN }}

0 commit comments

Comments
 (0)