Skip to content

Commit da0fb78

Browse files
committed
fix: git create release tag
1 parent f8db158 commit da0fb78

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/release.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,21 @@ jobs:
3333
run: |
3434
uv sync --dev
3535
36-
- name: Get package version
37-
id: get_version
36+
- name: Compute tag (use existing tag or create new on main)
3837
run: |
3938
VERSION=$(grep -m1 'version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
4039
echo "VERSION=$VERSION" >> $GITHUB_ENV
41-
echo "Package version: $VERSION"
40+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
41+
TAG="${GITHUB_REF#refs/tags/}"
42+
else
43+
TAG="v${VERSION}-${GITHUB_SHA::7}"
44+
git config --global user.name "github-actions[bot]"
45+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
46+
git tag "$TAG"
47+
git push origin "$TAG"
48+
fi
49+
echo "TAG=$TAG" >> $GITHUB_ENV
50+
echo "Using tag: $TAG"
4251
4352
- name: Build package
4453
run: uv build
@@ -58,8 +67,8 @@ jobs:
5867
env:
5968
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6069
with:
61-
tag_name: v${{ env.VERSION }}
62-
release_name: Release v${{ env.VERSION }}
70+
tag_name: ${{ env.TAG }}
71+
release_name: Release ${{ env.TAG }}
6372
draft: false
6473
prerelease: false
6574

0 commit comments

Comments
 (0)