-
-
Notifications
You must be signed in to change notification settings - Fork 5
60 lines (51 loc) · 1.65 KB
/
release.yml
File metadata and controls
60 lines (51 loc) · 1.65 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
name: Release
on:
push:
branches: [main]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up uv
uses: astral-sh/setup-uv@v4
- name: Read current version
id: version
run: |
VERSION=$(grep '^__version__' src/agent_trace/__init__.py \
| sed 's/.*"\(.*\)"/\1/')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Compute release tag
id: tag
run: |
VERSION="${{ steps.version.outputs.version }}"
# Append short SHA if a tag for this exact version already exists,
# so rapid merges never collide on the same tag.
if git rev-parse "v${VERSION}" >/dev/null 2>&1; then
SHORT_SHA=$(git rev-parse --short HEAD)
TAG="v${VERSION}-${SHORT_SHA}"
else
TAG="v${VERSION}"
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- name: Build changelog
run: |
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$LAST_TAG" ]; then
git log --pretty=format:"- %s" HEAD | head -20 > /tmp/changelog.txt
else
git log "${LAST_TAG}..HEAD" --pretty=format:"- %s" > /tmp/changelog.txt
fi
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.tag.outputs.tag }}"
gh release create "$TAG" \
--title "$TAG" \
--notes-file /tmp/changelog.txt \
--target "${{ github.sha }}"