Debian Codegraph @

.github/workflows/publish_python.yml

raw
1 name: Upload Python Package
2
3 on:
4 release:
5 types: [published]
6 workflow_dispatch:
7 inputs:
8 tag:
9 description: 'Tag to build and publish (e.g. v5.1.0)'
10 required: true
11 type: string
12
13 permissions:
14 contents: read
15
16 jobs:
17 test:
18 runs-on: ubuntu-latest
19 timeout-minutes: 10
20 strategy:
21 matrix:
22 python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
23
24 steps:
25 - uses: actions/checkout@v7
26 with:
27 ref: ${{ inputs.tag || github.ref }}
28
29 - name: Set up uv and Python ${{ matrix.python-version }}
30 uses: astral-sh/[email protected]
31 with:
32 enable-cache: true
33 python-version: ${{ matrix.python-version }}
34
35 - name: Install dependencies
36 run: uv sync
37
38 - name: Test the package
39 run: ./test.sh
40
41 deploy:
42 runs-on: ubuntu-latest
43 needs: [test]
44 environment: release
45 permissions:
46 id-token: write
47 steps:
48 - uses: actions/checkout@v7
49 with:
50 ref: ${{ inputs.tag || github.ref }}
51 - name: Set up uv
52 uses: astral-sh/[email protected]
53 with:
54 enable-cache: true
55 - name: Build
56 run: uv build
57 - name: Publish
58 uses: pypa/gh-action-pypi-publish@release/v1