-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (53 loc) · 1.42 KB
/
release.yml
File metadata and controls
56 lines (53 loc) · 1.42 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
---
name: Release
# yamllint disable-line rule:truthy
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-slim
timeout-minutes: 5
environment: release
permissions:
contents: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup UV
uses: astral-sh/setup-uv@v7
- name: Detect version change
id: version-check
run: |
awk '{
if ($1 == "version") {
gsub("\"", "", $3);
print $3;
}
}' pyproject.toml > .package-version
VERSION="$(cat .package-version)"
if git rev-parse "v${VERSION}" > /dev/null 2>&1 ; then
NEW_VERSION=false
else
NEW_VERSION=true
fi
{
echo "VERSION=${VERSION}"
echo "NEW_VERSION=${NEW_VERSION}"
} >> "$GITHUB_OUTPUT"
- name: Build and publish
if: steps.version-check.outputs.NEW_VERSION == 'true'
run: |
uv build
uv publish
- name: Create GitHub release
if: steps.version-check.outputs.NEW_VERSION == 'true'
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ steps.version-check.outputs.VERSION }}
generate_release_notes: true
files: dist/*