Skip to content

Commit 01814dd

Browse files
committed
feat: tag bash
1 parent fa17c4e commit 01814dd

File tree

2 files changed

+17
-37
lines changed

2 files changed

+17
-37
lines changed

dc3/git/git-tag-release.sh

-34
This file was deleted.

dc3/git/git-tag-develop.sh dc3/git/tag.sh

+17-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,25 @@ set -e
1717

1818
cd ../../
1919

20+
type=""
21+
22+
if `git status | grep "develop" &>/dev/null`; then
23+
type="develop"
24+
fi
25+
if `git status | grep "release" &>/dev/null`; then
26+
type="release"
27+
fi
28+
if [[ ${type} == "" ]]; then
29+
echo -e "This branch doesn't support tagging, please switch to the \033[31mdevelop\033[0m or \033[31mrelease\033[0m branch."
30+
exit
31+
fi
32+
33+
2034
git pull --tags
2135
# shellcheck disable=SC2046
2236
# shellcheck disable=SC2116
23-
develop_tag=$(echo dc3.develop.$(date +'%Y%m%d').$(git tag -l "dc3.develop.$(date +'%Y%m%d').*" | wc -l | xargs printf '%02d'))
24-
echo "${develop_tag}"
25-
git tag "${develop_tag}"
37+
tag=$(echo dc3.${type}.$(date +'%Y%m%d').$(git tag -l "dc3.${type}.$(date +'%Y%m%d').*" | wc -l | xargs printf '%02d'))
38+
echo "${tag}"
39+
git tag "${tag}"
2640

2741
git push origin --tags

0 commit comments

Comments
 (0)