Skip to content

Commit df7b67d

Browse files
Copilotdbehnke
andauthored
fix: prevent pre-release workflow from running on release commits (#71)
* Initial plan * fix: prevent pre-release workflow from running on release commits This fix prevents the pre-release workflow from creating duplicate tags on release commits, which was causing release-please to not detect new changes properly. Co-authored-by: dbehnke <916775+dbehnke@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dbehnke <916775+dbehnke@users.noreply.github.com>
1 parent 57d752f commit df7b67d

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/prerelease.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,33 @@ jobs:
2626
ref: ${{ github.event.workflow_run.head_sha }}
2727
fetch-depth: 0
2828

29+
# Skip if this is a release commit from release-please
30+
- name: Check if release commit
31+
id: check_release
32+
run: |
33+
COMMIT_MSG=$(git log -1 --pretty=%B)
34+
if echo "$COMMIT_MSG" | grep -q "^chore(main): release"; then
35+
echo "is_release=true" >> $GITHUB_OUTPUT
36+
echo "This is a release commit, skipping pre-release creation"
37+
else
38+
echo "is_release=false" >> $GITHUB_OUTPUT
39+
echo "This is not a release commit, proceeding with pre-release"
40+
fi
41+
2942
- name: Set up Go
43+
if: steps.check_release.outputs.is_release != 'true'
3044
uses: actions/setup-go@v6
3145
with:
3246
go-version: '1.25.3'
3347

3448
- name: Set up Node.js
49+
if: steps.check_release.outputs.is_release != 'true'
3550
uses: actions/setup-node@v6
3651
with:
3752
node-version: '20'
3853

3954
- name: Cache Node modules
55+
if: steps.check_release.outputs.is_release != 'true'
4056
uses: actions/cache@v4
4157
with:
4258
path: frontend/node_modules
@@ -45,10 +61,12 @@ jobs:
4561
${{ runner.os }}-node-
4662
4763
- name: Install frontend dependencies
64+
if: steps.check_release.outputs.is_release != 'true'
4865
working-directory: ./frontend
4966
run: npm ci
5067

5168
- name: Generate semantic version tag
69+
if: steps.check_release.outputs.is_release != 'true'
5270
id: tag
5371
env:
5472
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
@@ -68,14 +86,15 @@ jobs:
6886
# Increment patch version for pre-release
6987
NEXT_PATCH=$((PATCH + 1))
7088
71-
# Create semantic version pre-release tag: v0.1.1-pre.20251026171047.e961141
89+
# Create semantic version pre-release tag: v0.6.1-pre.20251026171047.e961141
7290
TAG="v${MAJOR}.${MINOR}.${NEXT_PATCH}-pre.${TIMESTAMP}.${SHA}"
7391
7492
echo "tag=${TAG}" >> $GITHUB_OUTPUT
7593
echo "sha=${SHA}" >> $GITHUB_OUTPUT
7694
echo "Generated pre-release tag: ${TAG}"
7795
7896
- name: Create and push tag for GoReleaser
97+
if: steps.check_release.outputs.is_release != 'true'
7998
env:
8099
TAG: ${{ steps.tag.outputs.tag }}
81100
run: |
@@ -85,6 +104,7 @@ jobs:
85104
git push origin "$TAG"
86105
87106
- name: Run GoReleaser to build and create pre-release
107+
if: steps.check_release.outputs.is_release != 'true'
88108
uses: goreleaser/goreleaser-action@v6
89109
with:
90110
distribution: goreleaser

0 commit comments

Comments
 (0)