|
| 1 | +name: Package Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main # Later, we would like to change this to "release". |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - main # Later, we would like to change this to "release". |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + python-version: [ "3.13" ] |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + persist-credentials: false |
| 21 | + - name: Set up Python ${{ matrix.python-version }} |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + - name: Install dependencies |
| 26 | + # language=bash |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + python -m pip install uv |
| 30 | + - name: Build |
| 31 | + # language=bash |
| 32 | + run: | |
| 33 | + uv build |
| 34 | + - name: Store the package |
| 35 | + uses: actions/upload-artifact@v4 |
| 36 | + with: |
| 37 | + name: python-package-distributions |
| 38 | + path: dist/ |
| 39 | + |
| 40 | + ############################## |
| 41 | + # Publish to the actual repo # |
| 42 | + ############################## |
| 43 | + publish-to-pypi: |
| 44 | + name: Publish to the actual server |
| 45 | + needs: |
| 46 | + - build |
| 47 | + runs-on: ubuntu-latest |
| 48 | + |
| 49 | + environment: pypi |
| 50 | + |
| 51 | + permissions: |
| 52 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: Download all the dists |
| 56 | + uses: actions/download-artifact@v4 |
| 57 | + with: |
| 58 | + name: python-package-distributions |
| 59 | + path: dist/ |
| 60 | + - name: Publish distribution 📦 to TestPyPI |
| 61 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 62 | + |
| 63 | +# ############################ |
| 64 | +# # Publish to the test repo # |
| 65 | +# ############################ |
| 66 | +# publish-to-testpypi: |
| 67 | +# name: Publish to the test server |
| 68 | +# needs: |
| 69 | +# - build |
| 70 | +# runs-on: ubuntu-latest |
| 71 | +# |
| 72 | +# environment: |
| 73 | +# name: pypi |
| 74 | +# url: https://test.pypi.org/p/deferrable-py |
| 75 | +# |
| 76 | +# permissions: |
| 77 | +# id-token: write # IMPORTANT: mandatory for trusted publishing |
| 78 | +# |
| 79 | +# steps: |
| 80 | +# - name: Download all the dists |
| 81 | +# uses: actions/download-artifact@v4 |
| 82 | +# with: |
| 83 | +# name: python-package-distributions |
| 84 | +# path: dist/ |
| 85 | +# - name: Publish distribution 📦 to TestPyPI |
| 86 | +# uses: pypa/gh-action-pypi-publish@release/v1 |
| 87 | +# with: |
| 88 | +# repository-url: https://test.pypi.org/legacy/ |
| 89 | + |
| 90 | + |
0 commit comments