|
| 1 | +# This workflow will upload a Python Package to PyPI when a release is created |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries |
| 3 | + |
| 4 | +# This workflow uses actions that are not certified by GitHub. |
| 5 | +# They are provided by a third-party and are governed by |
| 6 | +# separate terms of service, privacy policy, and support |
| 7 | +# documentation. |
| 8 | + |
| 9 | +name: Upload Python Package |
| 10 | + |
| 11 | +on: |
| 12 | + release: |
| 13 | + types: [published] |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + release-build: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + submodules: 'recursive' |
| 29 | + token: ${{ secrets.PAT_TOKEN }} |
| 30 | + |
| 31 | + - uses: actions/setup-python@v5 |
| 32 | + with: |
| 33 | + python-version: "3.x" |
| 34 | + |
| 35 | + - name: Run CUDA bash shell |
| 36 | + env: |
| 37 | + temp: ${{ runner.temp }} |
| 38 | + cuda: '12.9' |
| 39 | + run: | |
| 40 | + chmod +x ${{ github.workspace }}/tensor-array-repo/Tensor-Array/scripts/actions/install-cuda-ubuntu.sh |
| 41 | + ${{ github.workspace }}/tensor-array-repo/Tensor-Array/scripts/actions/install-cuda-ubuntu.sh |
| 42 | +
|
| 43 | + - name: Build release distributions |
| 44 | + run: | |
| 45 | + # NOTE: put your own distribution build steps here. |
| 46 | + python -m pip install build |
| 47 | + python -m build |
| 48 | +
|
| 49 | + - name: Upload distributions |
| 50 | + uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: release-dists |
| 53 | + path: dist/ |
| 54 | + |
| 55 | + pypi-publish: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + needs: |
| 58 | + - release-build |
| 59 | + permissions: |
| 60 | + # IMPORTANT: this permission is mandatory for trusted publishing |
| 61 | + id-token: write |
| 62 | + |
| 63 | + # Dedicated environments with protections for publishing are strongly recommended. |
| 64 | + # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules |
| 65 | + environment: |
| 66 | + name: TensorArray |
| 67 | + url: https://pypi.org/p/TensorArray/${{ github.event.release.name }} |
| 68 | + # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: |
| 69 | + # url: https://pypi.org/p/YOURPROJECT |
| 70 | + # |
| 71 | + # ALTERNATIVE: if your GitHub Release name is the PyPI project version string |
| 72 | + # ALTERNATIVE: exactly, uncomment the following line instead: |
| 73 | + # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} |
| 74 | + |
| 75 | + steps: |
| 76 | + - name: Retrieve release distributions |
| 77 | + uses: actions/download-artifact@v4 |
| 78 | + with: |
| 79 | + name: release-dists |
| 80 | + path: dist/ |
| 81 | + |
| 82 | + - name: Publish release distributions to PyPI |
| 83 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 84 | + with: |
| 85 | + packages-dir: dist/ |
| 86 | + |
| 87 | + testpypi-publish: |
| 88 | + runs-on: ubuntu-latest |
| 89 | + needs: |
| 90 | + - release-build |
| 91 | + permissions: |
| 92 | + # IMPORTANT: this permission is mandatory for trusted publishing |
| 93 | + id-token: write |
| 94 | + |
| 95 | + # Dedicated environments with protections for publishing are strongly recommended. |
| 96 | + # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules |
| 97 | + environment: |
| 98 | + name: TensorArray |
| 99 | + url: https://test.pypi.org/p/TensorArray |
| 100 | + # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: |
| 101 | + # url: https://pypi.org/p/YOURPROJECT |
| 102 | + # |
| 103 | + # ALTERNATIVE: if your GitHub Release name is the PyPI project version string |
| 104 | + # ALTERNATIVE: exactly, uncomment the following line instead: |
| 105 | + # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} |
| 106 | + |
| 107 | + steps: |
| 108 | + - name: Retrieve release distributions |
| 109 | + uses: actions/download-artifact@v4 |
| 110 | + with: |
| 111 | + name: release-dists |
| 112 | + path: dist/ |
| 113 | + |
| 114 | + - name: Publish release distributions to TestPyPI |
| 115 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 116 | + with: |
| 117 | + repository-url: https://test.pypi.org/legacy/ |
| 118 | + packages-dir: dist/ |
| 119 | + |
0 commit comments