|
1 |
| -name: CI/CD |
| 1 | +name: DroidMind CI/CD |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
5 |
| - branches: [ main ] |
| 5 | + branches: [main] |
6 | 6 | tags:
|
7 |
| - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 7 | + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 |
8 | 8 | pull_request:
|
9 |
| - branches: [ main ] |
| 9 | + branches: [main] |
| 10 | + workflow_dispatch: # Allow manual triggering |
10 | 11 |
|
11 | 12 | jobs:
|
12 | 13 | build-and-test:
|
13 | 14 | runs-on: ubuntu-latest
|
14 | 15 | steps:
|
15 |
| - - uses: actions/checkout@v3 |
16 |
| - - name: Set up Python |
17 |
| - uses: actions/setup-python@v4 |
18 |
| - with: |
19 |
| - python-version: '3.13' |
20 |
| - - name: Set up uv |
21 |
| - uses: astral-sh/setup-uv@v5 |
22 |
| - with: |
23 |
| - version: "0.6.3" |
24 |
| - - name: Install dependencies |
25 |
| - run: uv sync |
26 |
| - - name: Run lint checks |
27 |
| - run: uv run ruff check . |
28 |
| - - name: Run tests |
29 |
| - run: uv run pytest |
30 |
| - - name: Upload test results |
31 |
| - uses: actions/upload-artifact@v4 |
32 |
| - with: |
33 |
| - name: test-results |
34 |
| - path: test-results |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + |
| 20 | + - name: 💿 Set up Python |
| 21 | + uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: "3.13" |
| 24 | + cache-dependency-path: "pyproject.toml" |
| 25 | + |
| 26 | + - name: 🛠️ Set up uv |
| 27 | + uses: astral-sh/setup-uv@v5 |
| 28 | + with: |
| 29 | + version: "0.6.3" |
| 30 | + |
| 31 | + - name: 📦 Install dependencies |
| 32 | + run: uv sync |
| 33 | + |
| 34 | + - name: 🔍 Ruff lint check |
| 35 | + uses: astral-sh/ruff-action@v3 |
| 36 | + with: |
| 37 | + version: latest |
| 38 | + |
| 39 | + - name: 🧪 Run tests |
| 40 | + run: uv run pytest |
35 | 41 |
|
36 | 42 | create-release:
|
37 | 43 | needs: [build-and-test]
|
38 | 44 | runs-on: ubuntu-latest
|
39 | 45 | if: startsWith(github.ref, 'refs/tags/')
|
| 46 | + permissions: |
| 47 | + contents: write |
40 | 48 | steps:
|
41 |
| - - uses: actions/checkout@v3 |
42 |
| - - name: Create Release |
43 |
| - id: create_release |
44 |
| - uses: actions/create-release@v1 |
45 |
| - env: |
46 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
47 |
| - with: |
48 |
| - tag_name: ${{ github.ref }} |
49 |
| - release_name: Release ${{ github.ref }} |
50 |
| - draft: false |
51 |
| - prerelease: false |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: 🏷️ Create Release |
| 52 | + uses: softprops/action-gh-release@v2 |
| 53 | + with: |
| 54 | + name: Release ${{ github.ref_name }} |
| 55 | + generate_release_notes: true |
52 | 56 |
|
53 |
| - release: |
| 57 | + publish: |
54 | 58 | needs: create-release
|
55 | 59 | runs-on: ubuntu-latest
|
| 60 | + if: startsWith(github.ref, 'refs/tags/') |
| 61 | + permissions: |
| 62 | + id-token: write # For trusted publishing |
56 | 63 | steps:
|
57 |
| - - uses: actions/checkout@v3 |
58 |
| - - name: Set up Python |
59 |
| - uses: actions/setup-python@v4 |
60 |
| - with: |
61 |
| - python-version: '3.13' |
62 |
| - - name: Set up uv |
63 |
| - uses: astral-sh/setup-uv@v1 |
64 |
| - - name: Install dependencies |
65 |
| - run: | |
66 |
| - uv pip install --system -e ".[dev]" |
67 |
| - uv pip install build twine |
68 |
| - - name: Build package |
69 |
| - run: uv run python -m build |
70 |
| - - name: Publish to PyPI |
71 |
| - env: |
72 |
| - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
73 |
| - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
74 |
| - run: | |
75 |
| - uv run twine upload dist/* |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + |
| 66 | + - name: 💿 Set up Python |
| 67 | + uses: actions/setup-python@v5 |
| 68 | + with: |
| 69 | + python-version: "3.13" |
| 70 | + |
| 71 | + - name: 🛠️ Set up uv |
| 72 | + uses: astral-sh/setup-uv@v5 |
| 73 | + |
| 74 | + - name: 📦 Build package |
| 75 | + run: | |
| 76 | + uv pip install build |
| 77 | + uv run python -m build |
| 78 | +
|
| 79 | + - name: 🚀 Publish to PyPI |
| 80 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments