Skip to content

Commit b5f1efd

Browse files
authored
[CI] Fix Linux aarch64 nightly wheel uploads (#1760)
1 parent c784065 commit b5f1efd

2 files changed

Lines changed: 32 additions & 9 deletions

File tree

.github/workflows/build-wheels-aarch64-linux.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ on:
2424
required: false
2525
type: boolean
2626
default: false
27-
secrets:
28-
PYPI_TOKEN:
29-
required: false
3027
workflow_dispatch:
3128

3229
permissions:
@@ -59,12 +56,12 @@ jobs:
5956
test-infra-ref: ${{ inputs.test-infra-ref || 'main' }}
6057
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
6158
package-name: ${{ matrix.package-name }}
62-
trigger-event: ${{ inputs.nightly && 'schedule' || github.event_name }}
59+
# Not 'schedule' for nightly: that enables test-infra's S3+PyPI upload jobs,
60+
# which need an AWS role tensordict cannot assume; nightly_build.yml uploads
61+
# to PyPI instead. ('' is falsy and would fall through to github.event_name.)
62+
trigger-event: ${{ inputs.nightly && 'skip-upload' || github.event_name }}
6363
env-var-script: .github/scripts/version_script.sh
6464
architecture: aarch64
6565
setup-miniconda: false
6666
build-command: ${{ inputs.nightly && 'bash .github/scripts/build-aarch64-nightly-wheel.sh' || 'pip wheel --no-deps . && mkdir -p dist && mv tensordict*.whl ./dist' }}
6767
build-platform: python-build-package
68-
upload-to-pypi: ${{ inputs.nightly && 'cpu' || '' }}
69-
secrets:
70-
PYPI_API_TOKEN: ${{ secrets.PYPI_TOKEN }}

.github/workflows/nightly_build.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,38 @@ jobs:
3535
uses: ./.github/workflows/build-wheels-aarch64-linux.yml
3636
with:
3737
nightly: true
38-
secrets:
39-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
4038
permissions:
4139
id-token: write
4240
contents: read
4341

42+
upload-wheel-aarch64:
43+
# Don't run on forked repos.
44+
# !cancelled(): upload whatever built even if some matrix entries failed.
45+
if: ${{ !cancelled() && github.repository_owner == 'pytorch' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }}
46+
needs: build-wheel-aarch64
47+
runs-on: ubuntu-22.04
48+
steps:
49+
- name: Download built wheels
50+
uses: actions/download-artifact@v4
51+
with:
52+
# Artifacts uploaded by test-infra, named pytorch_tensordict__<python>_cpu_aarch64
53+
pattern: pytorch_tensordict_*_aarch64
54+
path: /tmp/wheels
55+
merge-multiple: true
56+
- name: Push tensordict Binary to PYPI
57+
env:
58+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
59+
run: |
60+
# Fail if no wheels were downloaded (e.g. test-infra renamed its artifacts).
61+
ls /tmp/wheels/tensordict_nightly-*.whl
62+
python3 -mpip install twine
63+
python3 -m twine upload \
64+
--username __token__ \
65+
--password "$PYPI_TOKEN" \
66+
--skip-existing \
67+
/tmp/wheels/tensordict_nightly-*.whl \
68+
--verbose
69+
4470
build-wheel-unix:
4571
# Don't run on forked repos.
4672
if: github.repository_owner == 'pytorch'

0 commit comments

Comments
 (0)