Skip to content

Commit d048882

Browse files
committed
automate releases and fix linux workflow
Signed-off-by: Rahul Krishna <[email protected]>
1 parent afb3a8d commit d048882

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Python uv Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write # required for GitHub Release
10+
id-token: write # required for PyPI Trusted Publishing
11+
actions: write # required for tag deletion
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Check out code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python 3.12
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.12'
25+
26+
- name: Install uv
27+
run: |
28+
curl -LsSf https://astral.sh/uv/install.sh | sh
29+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
30+
31+
- name: Sync dependencies
32+
run: uv sync --all-groups
33+
34+
- name: Run tests
35+
id: test
36+
continue-on-error: true
37+
run: uv run pytest
38+
39+
- name: Delete tag on failure
40+
if: steps.test.conclusion == 'failure'
41+
run: |
42+
echo "Tests failed. Deleting tag ${GITHUB_REF#refs/tags/}..."
43+
git config --global user.name "github-actions[bot]"
44+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
45+
git push --delete origin ${GITHUB_REF#refs/tags/}
46+
exit 1
47+
48+
- name: Build package
49+
run: uv build
50+
51+
- name: Build changelog
52+
id: gen_changelog
53+
uses: mikepenz/release-changelog-builder-action@v5
54+
with:
55+
failOnError: "true"
56+
configuration: .github/workflows/release_config.json
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Publish release on GitHub
61+
uses: softprops/action-gh-release@v1
62+
with:
63+
files: dist/*
64+
body: ${{ steps.gen_changelog.outputs.changelog }}
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Publish to PyPI via Trusted Publishing
69+
run: uv publish
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "## ✨ Release",
5+
"labels": [
6+
"release"
7+
]
8+
},
9+
{
10+
"title": "## 🚀 Features",
11+
"labels": [
12+
"kind/feature",
13+
"enhancement"
14+
]
15+
},
16+
{
17+
"title": "## 🐛 Fixes",
18+
"labels": [
19+
"fix",
20+
"bug"
21+
]
22+
},
23+
{
24+
"title": "## ♻️ Refactoring",
25+
"labels": [
26+
"refactoring"
27+
]
28+
},
29+
{
30+
"title": "## ⚡️ Performance Improvements",
31+
"labels": [
32+
"performance"
33+
]
34+
},
35+
{
36+
"title": "## \uD83D\uDCDA Documentation",
37+
"labels": [
38+
"documentation",
39+
"doc"
40+
]
41+
},
42+
{
43+
"title": "## \uD83D\uDEA6 Tests",
44+
"labels": [
45+
"test"
46+
]
47+
},
48+
{
49+
"title": "## \uD83D\uDEE0 Other Updates",
50+
"labels": [
51+
"other",
52+
"kind/dependency-change"
53+
]
54+
},
55+
{
56+
"title": "## 🚨 Breaking Changes",
57+
"labels": [
58+
"breaking"
59+
]
60+
}
61+
],
62+
"ignore_labels": [
63+
"ignore"
64+
]
65+
}

0 commit comments

Comments
 (0)