Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit dbbda48

Browse files
committed
🔧 Add in the ability to turn off emojis when releasing
1 parent f2bb4a6 commit dbbda48

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

libexec/handles-release

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set -e
77
cd "$(git rev-parse --show-toplevel 2>/dev/null)"
88

99
BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null || true)"
10+
USE_EMOJI="$(git config release.emoji || true)"
1011
VERSION="$1"
1112

1213
if [ -z "$VERSION" ]; then
@@ -71,9 +72,13 @@ if [ -f "CHANGELOG.md" ] && ! grep -q "^# ${VERSION}" CHANGELOG.md &>/dev/null;
7172
printf "# %s - %s\\n\\n" "$VERSION" "$(date +"%d %b %Y")" > CHANGELOG.tmp
7273

7374
if [ -n "$PREV_VERSION" ]; then
74-
git log --reverse --no-merges --format='- %s' "$PREV_VERSION"..HEAD | grep -v ":bookmark:"
75+
git log --reverse --no-merges --format='- %s' "$PREV_VERSION"..HEAD
7576
else
76-
echo "- :tada: Initial release"
77+
if [ "$USE_EMOJI" == "true" ]; then
78+
echo "- :tada: Initial release"
79+
else
80+
echo "- Initial release"
81+
fi
7782
fi >> CHANGELOG.tmp
7883

7984
if [ -s "CHANGELOG.md" ]; then
@@ -86,8 +91,14 @@ if [ -f "CHANGELOG.md" ] && ! grep -q "^# ${VERSION}" CHANGELOG.md &>/dev/null;
8691
fi
8792

8893
if ! git diff-index --cached --quiet HEAD --; then
94+
if [ "$USE_EMOJI" == "true" ]; then
95+
COMMIT_MSG=":bookmark: Release ${VERSION}"
96+
else
97+
COMMIT_MSG="Release ${VERSION}"
98+
fi
99+
89100
echo "==> Preparing release…"
90-
if ! git commit -m ":bookmark: Release ${VERSION}" &>/dev/null; then
101+
if ! git commit -m "$COMMIT_MSG" &>/dev/null; then
91102
echo "!!! Error: failed to prepare release" >&2
92103
exit 1
93104
fi
@@ -102,8 +113,14 @@ if [ "$(git rev-list --count "${BRANCH}@{upstream}"..HEAD)" != "0" ]; then
102113
fi
103114

104115
if [ "$BRANCH" == "master" ]; then
116+
if [ "$USE_EMOJI" == "true" ]; then
117+
RELEASE_MSG=":bookmark: Tag ${VERSION}"
118+
else
119+
RELEASE_MSG="Tag ${VERSION}"
120+
fi
121+
105122
echo "==> Tagging release…"
106-
if ! git tag -a -s "$VERSION" -m ":bookmark: Tag ${VERSION}" &>/dev/null; then
123+
if ! git tag -a -s "$VERSION" -m "$RELEASE_MSG" &>/dev/null; then
107124
echo "!!! Error: failed to tag release" >&2
108125
exit 1
109126
fi

0 commit comments

Comments
 (0)