Skip to content

Commit 313d4a8

Browse files
authored
feat!: setup initial 1.0.0 release
1 parent a53708b commit 313d4a8

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ jobs:
2424
with:
2525
fetch-depth: 1
2626

27-
- name: Check commit message
27+
- name: Check commit message and branch
2828
id: check
2929
run: |
3030
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
31+
BRANCH_NAME=${{ github.ref_name }}
3132
3233
if [[ $COMMIT_MESSAGE =~ ^feat!.* ]] || [[ $COMMIT_MESSAGE =~ ^feat:.* ]] || [[ $COMMIT_MESSAGE =~ ^fix:.* ]]; then
3334
echo "should_release=true" >> $GITHUB_OUTPUT
3435
else
3536
echo "should_release=false" >> $GITHUB_OUTPUT
3637
echo "No version bump needed (commit: $COMMIT_MESSAGE)"
37-
fi
38+
fi /
3839
3940
release:
4041
needs: check-commit
@@ -105,16 +106,28 @@ jobs:
105106
fi
106107
107108
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"
110123
111124
git config user.name "GitHub Actions"
112125
git config user.email "actions@github.com"
113126
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"
115128
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"
118131
119132
# Generate release notes from commits since last tag
120133
if [ -z "$LATEST_TAG" ]; then
@@ -126,7 +139,7 @@ jobs:
126139
echo "Release notes:"
127140
echo "$RELEASE_NOTES"
128141
129-
gh release create "$PRE_RELEASE_TAG" \
130-
--title "Pre-release $PRE_RELEASE_TAG" \
142+
gh release create "$RELEASE_TAG" \
143+
--title "$RELEASE_TITLE" \
131144
--notes "$RELEASE_NOTES" \
132-
--prerelease
145+
--prerelease=$IS_PRERELEASE

0 commit comments

Comments
 (0)