@@ -24,17 +24,18 @@ jobs:
24
24
with :
25
25
fetch-depth : 1
26
26
27
- - name : Check commit message
27
+ - name : Check commit message and branch
28
28
id : check
29
29
run : |
30
30
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
31
+ BRANCH_NAME=${{ github.ref_name }}
31
32
32
33
if [[ $COMMIT_MESSAGE =~ ^feat!.* ]] || [[ $COMMIT_MESSAGE =~ ^feat:.* ]] || [[ $COMMIT_MESSAGE =~ ^fix:.* ]]; then
33
34
echo "should_release=true" >> $GITHUB_OUTPUT
34
35
else
35
36
echo "should_release=false" >> $GITHUB_OUTPUT
36
37
echo "No version bump needed (commit: $COMMIT_MESSAGE)"
37
- fi
38
+ fi /
38
39
39
40
release :
40
41
needs : check-commit
@@ -105,16 +106,28 @@ jobs:
105
106
fi
106
107
107
108
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
108
- PRE_RELEASE_TAG="$NEW_VERSION-pre"
109
- echo "Bumping version from $CURRENT_VERSION to $PRE_RELEASE_TAG"
109
+ BRANCH_NAME=${{ github.ref_name }}
110
+
111
+ # Determine tag and release type based on branch
112
+ if [ "$BRANCH_NAME" = "main" ]; then
113
+ RELEASE_TAG="$NEW_VERSION"
114
+ RELEASE_TITLE="Release $NEW_VERSION"
115
+ IS_PRERELEASE=false
116
+ else
117
+ RELEASE_TAG="next-$NEW_VERSION"
118
+ RELEASE_TITLE="Pre-release next-$NEW_VERSION"
119
+ IS_PRERELEASE=true
120
+ fi
121
+
122
+ echo "Bumping version from $CURRENT_VERSION to $RELEASE_TAG"
110
123
111
124
git config user.name "GitHub Actions"
112
125
git config user.email "actions@github.com"
113
126
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
114
- git push origin ${{ github.ref_name }}
127
+ git push origin "$BRANCH_NAME"
115
128
116
- git tag -a "$PRE_RELEASE_TAG " -m "$PRE_RELEASE_TAG "
117
- git push origin "$PRE_RELEASE_TAG "
129
+ git tag -a "$RELEASE_TAG " -m "$RELEASE_TAG "
130
+ git push origin "$RELEASE_TAG "
118
131
119
132
# Generate release notes from commits since last tag
120
133
if [ -z "$LATEST_TAG" ]; then
@@ -126,7 +139,7 @@ jobs:
126
139
echo "Release notes:"
127
140
echo "$RELEASE_NOTES"
128
141
129
- gh release create "$PRE_RELEASE_TAG " \
130
- --title "Pre-release $PRE_RELEASE_TAG " \
142
+ gh release create "$RELEASE_TAG " \
143
+ --title "$RELEASE_TITLE " \
131
144
--notes "$RELEASE_NOTES" \
132
- --prerelease
145
+ --prerelease=$IS_PRERELEASE
0 commit comments