Release binary to pypi #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release binary to pypi | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| dryrun: | |
| required: true | |
| type: choice | |
| default: enabled | |
| options: | |
| - enabled | |
| - disabled | |
| package: | |
| description: "Domain to prepare and release" | |
| required: true | |
| type: choice | |
| default: torchao | |
| options: | |
| - torchao | |
| - torchtune | |
| - executorch | |
| - torchvision | |
| - torchaudio | |
| - torchcodec | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| trigger: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| environment: pytorchbot-env | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Configure aws credentials (pytorch account) | |
| uses: aws-actions/configure-aws-credentials@50ac8dd1e1b10d09dac7b8727528b91bed831ac0 # v3.0.2 | |
| with: | |
| role-to-assume: arn:aws:iam::749337293305:role/gha_workflow_stage_wheels | |
| aws-region: us-east-1 | |
| - name: Install AWS CLI v2 | |
| run: | | |
| curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip | |
| unzip -q /tmp/awscliv2.zip -d /tmp | |
| sudo /tmp/aws/install --update | |
| rm -rf /tmp/aws/ /tmp/awscliv2.zip | |
| - name: Verify AWS CLI installation | |
| run: aws --version | |
| - name: Copy staged binaries | |
| shell: bash | |
| env: | |
| PACKAGE: ${{ inputs.package || 'torchvision' }} | |
| DRY_RUN: ${{ inputs.dryrun || 'enabled' }} | |
| run: | | |
| set -ex | |
| # Init release versions variables | |
| source ./release/release_versions.sh | |
| # shellcheck disable=SC2086 | |
| version="${PACKAGE^^}_VERSION" | |
| mkdir dist/ | |
| # shellcheck disable=SC2086 | |
| aws s3 sync "s3://pytorch-backup/${PACKAGE}-${!version}-pypi-staging/" dist/ --debug | |
| - name: Display structure of downloaded files | |
| run: ls -R dist/ | |
| - name: Publish package to PyPI | |
| if: ${{ inputs.dryrun == 'disabled' }} | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| verbose: true |