Skip to content

Commit dee8ec7

Browse files
fix: combine auto-tag and release into one workflow
Tags pushed with GITHUB_TOKEN don't trigger other workflows, so the separate release.yml never fired. Collapse both into a single workflow that creates the tag then creates the release in the same run.
1 parent 124cb60 commit dee8ec7

2 files changed

Lines changed: 27 additions & 26 deletions

File tree

.github/workflows/auto-tag.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Auto Tag
1+
name: Auto Tag and Release
22

33
on:
44
push:
@@ -9,6 +9,9 @@ jobs:
99
runs-on: ubuntu-latest
1010
permissions:
1111
contents: write
12+
outputs:
13+
tag: ${{ steps.tag.outputs.tag }}
14+
created: ${{ steps.tag.outputs.created }}
1215

1316
steps:
1417
- name: Checkout code
@@ -17,18 +20,41 @@ jobs:
1720
fetch-depth: 0
1821

1922
- name: Create tag if needed
23+
id: tag
2024
run: |
2125
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
2226
TAG="v${VERSION}"
2327
2428
echo "Detected version: $VERSION"
2529
echo "Tag: $TAG"
30+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
2631
2732
if git rev-parse "$TAG" >/dev/null 2>&1; then
2833
echo "Tag $TAG already exists. Nothing to do."
34+
echo "created=false" >> "$GITHUB_OUTPUT"
2935
exit 0
3036
fi
3137
3238
echo "Creating and pushing tag $TAG"
3339
git tag "$TAG"
3440
git push origin "$TAG"
41+
echo "created=true" >> "$GITHUB_OUTPUT"
42+
43+
release:
44+
needs: auto-tag
45+
if: needs.auto-tag.outputs.created == 'true'
46+
runs-on: ubuntu-latest
47+
permissions:
48+
contents: write
49+
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Create GitHub Release
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
gh release create "${{ needs.auto-tag.outputs.tag }}" \
59+
--title "Release ${{ needs.auto-tag.outputs.tag }}" \
60+
--generate-notes

.github/workflows/release.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)