|
5 | 5 | - main |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - release: |
9 | | - name: Release |
| 8 | + build: |
| 9 | + name: Build |
10 | 10 | runs-on: ubuntu-latest |
11 | 11 | steps: |
12 | 12 | - name: Checkout |
13 | 13 | uses: actions/checkout@v4 |
| 14 | + - name: Set up Python |
| 15 | + uses: actions/setup-python@v5 |
| 16 | + with: |
| 17 | + python-version: "3.x" |
| 18 | + - name: Install dependencies |
| 19 | + run: | |
| 20 | + python -m pip install --upgrade pip |
| 21 | + pip install flake8 pytest |
| 22 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 23 | + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi |
| 24 | + - name: Lint with flake8 |
| 25 | + run: | |
| 26 | + # stop the build if there are Python syntax errors or undefined names |
| 27 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 28 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 29 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 30 | + - name: Install pypa/build |
| 31 | + run: >- |
| 32 | + python3 -m |
| 33 | + pip install |
| 34 | + build |
| 35 | + --user |
| 36 | + - name: Build a binary wheel and a source tarball |
| 37 | + run: python3 -m build |
| 38 | + - name: Store the distribution packages |
| 39 | + uses: actions/upload-artifact@v3 |
| 40 | + with: |
| 41 | + name: python-package-distributions |
| 42 | + path: dist/ |
| 43 | + publish-to-pypi: |
| 44 | + name: >- |
| 45 | + Publish Package to PyPI |
| 46 | + needs: |
| 47 | + - build |
| 48 | + runs-on: ubuntu-latest |
| 49 | + environment: |
| 50 | + name: pypi |
| 51 | + url: https://pypi.org/p/klimapi-python |
| 52 | + permissions: |
| 53 | + id-token: write |
| 54 | + steps: |
| 55 | + - name: Download all the dists |
| 56 | + uses: actions/download-artifact@v3 |
| 57 | + with: |
| 58 | + name: python-package-distributions |
| 59 | + path: dist/ |
| 60 | + - name: Publish distribution 📦 to PyPI |
| 61 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 62 | + release: |
| 63 | + name: Release |
| 64 | + needs: |
| 65 | + - publish-to-pypi |
| 66 | + runs-on: ubuntu-latest |
| 67 | + permissions: |
| 68 | + contents: write |
| 69 | + id-token: write |
| 70 | + steps: |
| 71 | + - name: Download all the dists |
| 72 | + uses: actions/download-artifact@v3 |
| 73 | + with: |
| 74 | + name: python-package-distributions |
| 75 | + path: dist/ |
| 76 | + - name: Sign the dists with Sigstore |
| 77 | + uses: sigstore/gh-action-sigstore-python@v2.1.1 |
| 78 | + with: |
| 79 | + inputs: >- |
| 80 | + ./dist/*.tar.gz |
| 81 | + ./dist/*.whl |
14 | 82 | - name: Create release |
15 | 83 | uses: ncipollo/release-action@v1 |
16 | 84 | env: |
|
21 | 89 | body: "### This release has been automatically generated due to API changes or bug fixes. \n\n**All changes are 100% backwards compatible**, unless it's a new major version (X.0.0). \n\nFor the complete API changelog, please visit our [Changelog](https://klimapi.com/resources/docs#tag/Changelog)." |
22 | 90 | draft: false |
23 | 91 | prerelease: false |
| 92 | + artifacts: "dist/*" |
0 commit comments