Skip to content

Commit b2acdda

Browse files
committed
Add pipeline
1 parent 93a882e commit b2acdda

File tree

2 files changed

+68
-46
lines changed

2 files changed

+68
-46
lines changed

.github/workflows/release.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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 }}

azure-pipelines.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)