-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (51 loc) · 1.53 KB
/
release.yaml
File metadata and controls
66 lines (51 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Build and Publish
on:
push:
branches:
- main
env:
MAJOR: 0
MINOR: 1
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout (with full history for versioning)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute patch version
id: version
run: |
LAST_TAG=$(git tag --list "v${MAJOR}.${MINOR}.*" --sort=-v:refname | head -n 1)
if [ -z "$LAST_TAG" ]; then
PATCH=0
else
PATCH=$(($(echo "$LAST_TAG" | awk -F. '{print $3}' | sed 's/^v//') + 1))
fi
VERSION="v${MAJOR}.${MINOR}.${PATCH}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Computed version: $VERSION"
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: pipx install uv
- name: Install dependencies
run: uv sync
- name: Run tests
run: uv run pytest .
- name: Update version in pyproject.toml
run: |
sed -i -E "s/^(version = \").*\"/\1${{ steps.version.outputs.version }}\"/" pyproject.toml
- name: Build package
run: uv build
- name: Publish to Azure Artifact using uv
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: uv publish
- name: Create version tag
run: |
git tag ${{ steps.version.outputs.version }}
git push origin ${{ steps.version.outputs.version }}