Skip to content

Commit

Permalink
release by title type
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinab25 authored Jun 23, 2022
1 parent cb59bf8 commit 7ff15ee
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/js-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,25 @@ if [ -n "$GIT_CHANGE_ID" ] && [[ "$GIT_CHANGE_TARGET" == "master" ]] && [[ "$GIT
if [ $(git tag | grep ^${version}$ | wc -l) -eq 1 ]; then
echo "Start release with changelog update on new version"

valid_curl_get_result https://api.github.com/repos/$GIT_ORG/$GIT_NAME/pulls/$GIT_CHANGE_ID title
GIT_PR_TITLE=$(echo $curl_result | jq -r ".title")
if [ -z "$GIT_CHANGE_TITLE" ]; then
valid_curl_get_result https://api.github.com/repos/$GIT_ORG/$GIT_NAME/pulls/$GIT_CHANGE_ID title
GIT_CHANGE_TITLE=$(echo $curl_result | jq -r ".title")
echo "Extracted PR title - $GIT_CHANGE_TITLE"
fi

echo "Extracted PR title - $GIT_PR_TITLE"

if [ $(echo "$GIT_PR_TITLE" | grep "^MINOR:" | wc -l ) -eq 1 ]; then
echo "Will use a MINOR version for release"
RELEASE_TYPE="patch"

if [ $(echo "$GIT_CHANGE_TITLE" | grep "^MINOR:" | wc -l ) -eq 1 ]; then
echo "Will use a MINOR version for release, title of PR is $GIT_CHANGE_TITLE"
RELEASE_TYPE="minor"
fi

if [ $(echo "$GIT_PR_TITLE" | grep "^MAJOR:" | wc -l ) -eq 1 ]; then
echo "Will use a MAJOR version for release"

if [ $(echo "$GIT_CHANGE_TITLE" | grep "^MAJOR:" | wc -l ) -eq 1 ]; then
echo "Will use a MAJOR version for release, title of PR is $GIT_CHANGE_TITLE"
RELEASE_TYPE="major"
fi

release-it --config /release-it.json --no-git.tag -i patch --ci
release-it --config /release-it.json --no-git.tag -i $RELEASE_TYPE --ci
else
echo "Existing version is not yet released, will only auto-update changelog"

Expand Down

0 comments on commit 7ff15ee

Please sign in to comment.