github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/.github/workflows/pypi-publish.yml (about)

     1  name: Publish Python distribution to PyPI
     2  
     3  on:
     4      workflow_dispatch:
     5          inputs:
     6            check_version:
     7              description: 'I confirm that I have verified version to be published at https://github.com/NVIDIA/aistore/blob/main/python/aistore/version.py'
     8              required: true
     9              type: boolean
    10              default: false
    11  jobs:
    12    build:
    13      name: Build distribution
    14      runs-on: ubuntu-latest
    15      if: ${{ inputs.check_version }}
    16      steps:
    17      - uses: actions/checkout@v4
    18      - name: Set up Python
    19        uses: actions/setup-python@v4
    20        with:
    21          python-version: "3.x"
    22      - name: Install pypa/build
    23        run: >-
    24          python3 -m
    25          pip install
    26          build
    27          --user
    28      - name: Build a binary wheel and a source tarball
    29        run: |
    30          pushd $GITHUB_WORKSPACE/python 
    31          python3 -m build
    32          popd
    33      - name: Store the distribution packages
    34        uses: actions/upload-artifact@v3
    35        with:
    36          name: python-package-distributions
    37          path: python/dist
    38  
    39    publish-to-pypi:
    40      name: >-
    41        Publish Python distribution to PyPI
    42      needs:
    43      - build
    44      runs-on: ubuntu-latest
    45      environment:
    46        name: pypi
    47        url: https://pypi.org/project/aistore/
    48      permissions:
    49        id-token: write  # IMPORTANT: mandatory for trusted publishing
    50  
    51      steps:
    52      - name: Download all the dists
    53        uses: actions/download-artifact@v3
    54        with:
    55          name: python-package-distributions
    56          path: dist/
    57      - name: Publish distribution to PyPI
    58        uses: pypa/gh-action-pypi-publish@release/v1