|
| 1 | +name: Publish DorkEye to PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "dev*" # Trigger su tag tipo dev4.8, dev4.9 ecc. |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read # Permesso minimo globale per tutti i job |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + name: Run Tests |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout repo |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Setup Python ${{ matrix.python-version }} |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: ${{ matrix.python-version }} |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + pip install -e ".[all]" |
| 34 | + pip install pytest pytest-cov |
| 35 | +
|
| 36 | + - name: Run tests |
| 37 | + run: pytest tests/ -v --cov=dorkeye --cov-report=xml |
| 38 | + |
| 39 | + build: |
| 40 | + name: Build Distribution |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: test |
| 43 | + permissions: |
| 44 | + contents: read |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout repo |
| 48 | + uses: actions/checkout@v4 |
| 49 | + |
| 50 | + - name: Setup Python |
| 51 | + uses: actions/setup-python@v5 |
| 52 | + with: |
| 53 | + python-version: "3.12" |
| 54 | + |
| 55 | + - name: Install build tools |
| 56 | + run: | |
| 57 | + python -m pip install --upgrade pip |
| 58 | + pip install build twine |
| 59 | +
|
| 60 | + - name: Build package |
| 61 | + run: python -m build |
| 62 | + |
| 63 | + - name: Check distribution |
| 64 | + run: twine check dist/* |
| 65 | + |
| 66 | + - name: Upload build artifacts |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: dist |
| 70 | + path: dist/ |
| 71 | + |
| 72 | + publish: |
| 73 | + name: Publish to PyPI |
| 74 | + runs-on: ubuntu-latest |
| 75 | + needs: build |
| 76 | + environment: |
| 77 | + name: pypi |
| 78 | + url: https://pypi.org/project/dorkeye/ |
| 79 | + permissions: |
| 80 | + contents: read |
| 81 | + id-token: write # Necessario per OIDC trusted publishing |
| 82 | + |
| 83 | + steps: |
| 84 | + - name: Download build artifacts |
| 85 | + uses: actions/download-artifact@v4 |
| 86 | + with: |
| 87 | + name: dist |
| 88 | + path: dist/ |
| 89 | + |
| 90 | + - name: Publish to PyPI |
| 91 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 92 | + |
| 93 | + github-release: |
| 94 | + name: Create GitHub Release |
| 95 | + runs-on: ubuntu-latest |
| 96 | + needs: publish |
| 97 | + permissions: |
| 98 | + contents: write # Necessario per creare release |
| 99 | + |
| 100 | + steps: |
| 101 | + - name: Checkout repo |
| 102 | + uses: actions/checkout@v4 |
| 103 | + with: |
| 104 | + fetch-depth: 0 |
| 105 | + |
| 106 | + - name: Download build artifacts |
| 107 | + uses: actions/download-artifact@v4 |
| 108 | + with: |
| 109 | + name: dist |
| 110 | + path: dist/ |
| 111 | + |
| 112 | + - name: Create GitHub Release |
| 113 | + uses: softprops/action-gh-release@v2 |
| 114 | + with: |
| 115 | + files: dist/* |
| 116 | + generate_release_notes: true |
| 117 | + body: | |
| 118 | + ## 🎯 DorkEye ${{ github.ref_name }} |
| 119 | +
|
| 120 | + Installazione: |
| 121 | + ```bash |
| 122 | + pip install dorkeye |
| 123 | + ``` |
| 124 | + |
| 125 | + Vedi [CHANGELOG.md](CHANGELOG.md) per i dettagli. |
0 commit comments