|
1 | | -# NOTE: This file is auto generated by OpenAPI Generator. |
2 | | -# URL: https://openapi-generator.tech |
3 | | -# |
4 | | -# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
| 1 | +# NOTE: This file is auto-generated by OpenAPI Generator. |
5 | 2 |
|
6 | | -name: messente_api Python package |
| 3 | +name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI |
7 | 4 |
|
8 | | -on: [push, pull_request] |
| 5 | +on: push |
9 | 6 |
|
10 | 7 | jobs: |
11 | 8 | build: |
12 | | - |
| 9 | + name: Build distribution 📦 |
13 | 10 | runs-on: ubuntu-latest |
14 | | - strategy: |
15 | | - matrix: |
16 | | - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
17 | 11 |
|
18 | 12 | steps: |
19 | 13 | - uses: actions/checkout@v4 |
20 | | - - name: Set up Python ${{ matrix.python-version }} |
21 | | - uses: actions/setup-python@v4 |
22 | 14 | with: |
23 | | - python-version: ${{ matrix.python-version }} |
24 | | - - name: Install dependencies |
25 | | - run: | |
26 | | - python -m pip install --upgrade pip |
27 | | - pip install -r requirements.txt |
28 | | - pip install -r test-requirements.txt |
29 | | - - name: Test with pytest |
30 | | - run: | |
31 | | - pytest --cov={{packageName}} |
| 15 | + persist-credentials: false |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v5 |
| 18 | + with: |
| 19 | + python-version: '3.x' |
| 20 | + - name: Install pypa/build |
| 21 | + run: python3 -m pip install build --user |
| 22 | + - name: Build a binary wheel and a source tarball |
| 23 | + run: python3 -m build |
| 24 | + - name: Store the distribution packages |
| 25 | + uses: actions/upload-artifact@v4 |
| 26 | + with: |
| 27 | + name: python-package-distributions |
| 28 | + path: dist/ |
| 29 | + |
| 30 | + publish-to-pypi: |
| 31 | + name: Publish Python 🐍 distribution 📦 to PyPI |
| 32 | + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes |
| 33 | + needs: |
| 34 | + - build |
| 35 | + runs-on: ubuntu-latest |
| 36 | + environment: |
| 37 | + name: pypi |
| 38 | + url: https://pypi.org/p/messente-api |
| 39 | + permissions: |
| 40 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Download all the dists |
| 44 | + uses: actions/download-artifact@v4 |
| 45 | + with: |
| 46 | + name: python-package-distributions |
| 47 | + path: dist/ |
| 48 | + - name: Publish distribution 📦 to PyPI |
| 49 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 50 | + |
| 51 | + github-release: |
| 52 | + name: Sign the Python 🐍 distribution 📦 with Sigstore and upload them to GitHub Release |
| 53 | + needs: |
| 54 | + - publish-to-pypi |
| 55 | + runs-on: ubuntu-latest |
| 56 | + permissions: |
| 57 | + contents: write # IMPORTANT: mandatory for making GitHub Releases |
| 58 | + id-token: write # IMPORTANT: mandatory for sigstore |
| 59 | + steps: |
| 60 | + - name: Download all the dists |
| 61 | + uses: actions/download-artifact@v4 |
| 62 | + with: |
| 63 | + name: python-package-distributions |
| 64 | + path: dist/ |
| 65 | + - name: Sign the dists with Sigstore |
| 66 | + uses: sigstore/gh-action-sigstore-python@v3.0.0 |
| 67 | + with: |
| 68 | + inputs: >- |
| 69 | + ./dist/*.tar.gz |
| 70 | + ./dist/*.whl |
| 71 | + - name: Upload artifact signatures to GitHub Release |
| 72 | + env: |
| 73 | + GITHUB_TOKEN: $ |
| 74 | + # Upload to GitHub Release using the `gh` CLI. |
| 75 | + # `dist/` contains the built packages, and the |
| 76 | + # sigstore-produced signatures and certificates. |
| 77 | + run: >- |
| 78 | + gh release upload |
| 79 | + '$' dist/** |
| 80 | + --repo '$' |
0 commit comments