File tree Expand file tree Collapse file tree 2 files changed +68
-46
lines changed
Expand file tree Collapse file tree 2 files changed +68
-46
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Publish
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ env :
9+ MAJOR : 0
10+ MINOR : 1
11+
12+ jobs :
13+ release :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Checkout (with full history for versioning)
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
21+
22+ - name : Compute patch version
23+ id : version
24+ run : |
25+ # Find last tag matching vMAJOR.MINOR.*
26+ LAST_TAG=$(git tag --list "v${MAJOR}.${MINOR}.*" --sort=-v:refname | head -n 1)
27+
28+ if [ -z "$LAST_TAG" ]; then
29+ PATCH=0
30+ else
31+ # Count commits since last tag
32+ PATCH=$(git rev-list ${LAST_TAG}..HEAD --count)
33+ fi
34+
35+ VERSION="v${MAJOR}.${MINOR}.${PATCH}"
36+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
37+ echo "Computed version: $VERSION"
38+
39+ - name : Set up Python 3.12
40+ uses : actions/setup-python@v5
41+ with :
42+ python-version : " 3.12"
43+
44+ - name : Install uv
45+ run : pipx install uv
46+
47+ - name : Install dependencies
48+ run : uv sync
49+
50+ - name : Run tests
51+ run : uv run pytest .
52+
53+ - name : Update version in pyproject.toml
54+ run : |
55+ sed -i -E "s/^(version = \").*\"/\1${{ steps.version.outputs.version }}\"/" pyproject.toml
56+
57+ - name : Build package
58+ run : uv build
59+
60+ - name : Publish to Azure Artifact using uv
61+ env :
62+ UV_PUBLISH_TOKEN : ${{ secrets.PYPI_TOKEN }}
63+ run : uv publish --index private-registry
64+
65+ - name : Create version tag
66+ run : |
67+ git tag ${{ steps.version.outputs.version }}
68+ git push origin ${{ steps.version.outputs.version }}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments