|
| 1 | +name: Publish prelapse to PyPI and TestPyPI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v[0-9]+.[0-9]+.[0-9]+" |
| 7 | + - "v[0-9]+.[0-9]+.[0-9]+-a[0-9]+" |
| 8 | + - "v[0-9]+.[0-9]+.[0-9]+-b[0-9]+" |
| 9 | + - "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" |
| 10 | + |
| 11 | +env: |
| 12 | + PACKAGE_NAME: "prelapse" |
| 13 | + OWNER: "PeteHemery" |
| 14 | + |
| 15 | +jobs: |
| 16 | + |
| 17 | + build: |
| 18 | + name: Build distribution 📦 |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + persist-credentials: false |
| 25 | + - name: Set up Python |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: "3.x" |
| 29 | + |
| 30 | + - name: Install pypa/build |
| 31 | + run: python -m pip install build --user |
| 32 | + - name: Build a binary wheel and a source tarball |
| 33 | + run: python -m build |
| 34 | + - name: Store the distribution packages |
| 35 | + uses: actions/upload-artifact@v4 |
| 36 | + with: |
| 37 | + name: python-package-distributions |
| 38 | + path: dist/ |
| 39 | + |
| 40 | + publish-to-pypi: |
| 41 | + name: >- |
| 42 | + Publish Python 🐍 distribution 📦 to PyPI |
| 43 | + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes |
| 44 | + needs: |
| 45 | + - build |
| 46 | + runs-on: ubuntu-latest |
| 47 | + environment: |
| 48 | + name: pypi |
| 49 | + url: https://pypi.org/p/prelapse |
| 50 | + permissions: |
| 51 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 52 | + steps: |
| 53 | + - name: Download all the dists |
| 54 | + uses: actions/download-artifact@v4 |
| 55 | + with: |
| 56 | + name: python-package-distributions |
| 57 | + path: dist/ |
| 58 | + - name: Publish distribution 📦 to PyPI |
| 59 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 60 | + |
| 61 | + publish-to-testpypi: |
| 62 | + name: Publish Python 🐍 distribution 📦 to TestPyPI |
| 63 | + needs: |
| 64 | + - build |
| 65 | + runs-on: ubuntu-latest |
| 66 | + environment: |
| 67 | + name: testpypi |
| 68 | + url: https://test.pypi.org/p/prelapse |
| 69 | + permissions: |
| 70 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 71 | + steps: |
| 72 | + - name: Download all the dists |
| 73 | + uses: actions/download-artifact@v4 |
| 74 | + with: |
| 75 | + name: python-package-distributions |
| 76 | + path: dist/ |
| 77 | + - name: Publish distribution 📦 to TestPyPI |
| 78 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 79 | + with: |
| 80 | + repository-url: https://test.pypi.org/legacy/ |
0 commit comments