generated from mumblepins/template-python-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbumpversion
More file actions
executable file
·20 lines (19 loc) · 835 Bytes
/
bumpversion
File metadata and controls
executable file
·20 lines (19 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
GIT_STATUS="$(git status --porcelain | xargs)"
if [ "$GIT_STATUS" != "M CHANGELOG.md" ]; then
echo "$GIT_STATUS"
echo "Please commit or stash your changes before running this script."
exit 1
fi
git add .
bumpversion --config-file ".config/.bumpversion.cfg" "$@" || exit 3
TAG_NAME="$(git tag -l --format '%(refname:strip=2)' --sort=creatordate | tail -n1)"
#TAG_CUR_HASH="$(git tag -l --format '%(objectname)' --sort=creatordate |tail -n1)"
TAG_MESSAGE="$(git tag -l --format '%(contents:subject)' --sort=creatordate | tail -n1)"
echo "TAG_NAME: $TAG_NAME"
echo "TAG_MESSAGE: $TAG_MESSAGE"
pre-commit run -a --hook-stage post-commit gitchangelog || true
git add CHANGELOG.md
git commit --amend -m "$TAG_MESSAGE"
NEW_HASH="$(git rev-parse HEAD)"
git tag -s -f -m "$TAG_MESSAGE" "$TAG_NAME" "$NEW_HASH"