|
| 1 | +name: Release ecosystem library from test to production. |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + dryrun: |
| 7 | + required: true |
| 8 | + type: choice |
| 9 | + default: enabled |
| 10 | + options: |
| 11 | + - enabled |
| 12 | + - disabled |
| 13 | + package: |
| 14 | + description: "Domain to prepare and release" |
| 15 | + required: true |
| 16 | + type: choice |
| 17 | + default: torchvision |
| 18 | + options: |
| 19 | + - torchao |
| 20 | + - torchtune |
| 21 | + - executorch |
| 22 | + - torchvision |
| 23 | + - torchaudio |
| 24 | + |
| 25 | +permissions: |
| 26 | + id-token: write |
| 27 | + contents: read |
| 28 | + |
| 29 | +jobs: |
| 30 | + trigger: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + timeout-minutes: 30 |
| 33 | + environment: promote-env |
| 34 | + container: |
| 35 | + image: pytorch/almalinux-builder:cpu |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 38 | + - name: Configure aws credentials (pytorch account) |
| 39 | + uses: aws-actions/configure-aws-credentials@50ac8dd1e1b10d09dac7b8727528b91bed831ac0 # v3.0.2 |
| 40 | + with: |
| 41 | + role-to-assume: arn:aws:iam::749337293305:role/gha_workflow_promote_wheels |
| 42 | + aws-region: us-east-1 |
| 43 | + - name: Promote library to download.pytorch.org |
| 44 | + shell: bash |
| 45 | + env: |
| 46 | + PACKAGE: ${{ inputs.package || 'torchvision' }} |
| 47 | + DRY_RUN: ${{ inputs.dryrun || 'enabled' }} |
| 48 | + run: | |
| 49 | + set -ex |
| 50 | + cd release |
| 51 | + # Install requirements |
| 52 | + pip install awscli==1.32.18 |
| 53 | +
|
| 54 | + promote_s3() { |
| 55 | + local package_name |
| 56 | + package_name=$1 |
| 57 | + local package_type |
| 58 | + package_type=$2 |
| 59 | + local promote_version |
| 60 | + promote_version=$3 |
| 61 | +
|
| 62 | + # shellcheck disable=SC2086 |
| 63 | + echo "=-=-=-= Promoting ${package_name}'s v${promote_version} ${package_type} packages' =-=-=-=" |
| 64 | + ( |
| 65 | + set -x |
| 66 | + # shellcheck disable=SC2086 |
| 67 | + TEST_PYTORCH_PROMOTE_VERSION="${promote_version}" \ |
| 68 | + PACKAGE_NAME="${package_name}" \ |
| 69 | + PACKAGE_TYPE="${package_type}" \ |
| 70 | + TEST_WITHOUT_GIT_TAG=1 \ |
| 71 | + DRY_RUN="${DRY_RUN}" ./promote/s3_to_s3.sh |
| 72 | + ) |
| 73 | + echo |
| 74 | + } |
| 75 | +
|
| 76 | + # Init release versions variables |
| 77 | + source ./release_versions.sh |
| 78 | + # Run promotion |
| 79 | + # shellcheck disable=SC2086 |
| 80 | + version="${PACKAGE^^}_VERSION" |
| 81 | + # shellcheck disable=SC2086 |
| 82 | + promote_s3 ${PACKAGE} whl "${!version}" |
0 commit comments