A newer bump-tag
This commit is contained in:
parent
3aac1f97d8
commit
6ac9294dea
55
bump-tag
55
bump-tag
|
@ -2,36 +2,36 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
test -f cosmos.conf && . ./cosmos.conf
|
|
||||||
|
|
||||||
echo "Fetching any updates from server:"
|
echo "Fetching any updates from server:"
|
||||||
git pull
|
git pull
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
if [[ -f ./cosmos.conf ]]; then
|
||||||
deftag=$(basename "$PWD")
|
. ./cosmos.conf
|
||||||
|
fi
|
||||||
|
if [[ -z ${1} ]]; then
|
||||||
|
deftag=$(basename "${PWD}")
|
||||||
else
|
else
|
||||||
deftag="$1"
|
deftag="${1}"
|
||||||
fi
|
fi
|
||||||
tagpfx=${tag:="${deftag}"}
|
tagpfx=${tag:="${deftag}"}
|
||||||
|
|
||||||
last_tag=$(git tag -l "${tagpfx}-*" | sort | tail -1)
|
last_tag=$(git tag -l "${tagpfx}-*" | sort | tail -1)
|
||||||
|
if [[ -n ${last_tag} ]]; then
|
||||||
|
echo "Verifying last tag ${last_tag}:"
|
||||||
|
(git tag -v "${last_tag}" | grep ^gpg:) || true
|
||||||
|
# again to not mask exit status of git with grep
|
||||||
|
git tag -v "${last_tag}" >/dev/null 2>&1
|
||||||
|
echo ""
|
||||||
|
|
||||||
echo "Verifying last tag ${last_tag}:"
|
echo "Differences between tag ${last_tag} and what you are about to sign:"
|
||||||
(git tag -v "${last_tag}" | grep ^gpg:) || true
|
env PAGER=cat git diff --color "${last_tag}..main"
|
||||||
# again to not mask exit status of git with grep
|
|
||||||
git tag -v "${last_tag}" >/dev/null 2>&1
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "Differences between tag ${last_tag} and what you are about to sign:"
|
iter=1
|
||||||
this_branch=$(git rev-parse --abbrev-ref HEAD)
|
ok=
|
||||||
env PAGER=cat git diff --color "${last_tag}..${this_branch}"
|
while test -z "$ok"; do
|
||||||
|
this_tag=$(date "+${tagpfx}-%Y-%m-%d-v$(printf "%02d" ${iter})")
|
||||||
iter=1
|
iter=$(( iter + 1))
|
||||||
ok=
|
|
||||||
while test -z "$ok"; do
|
|
||||||
this_tag=$(date "+${tagpfx}-%Y-%m-%d-v$(printf "%02d" $iter)")
|
|
||||||
iter=$((iter + 1))
|
|
||||||
case $( (
|
case $( (
|
||||||
echo "${this_tag}"
|
echo "${this_tag}"
|
||||||
echo "${last_tag}"
|
echo "${last_tag}"
|
||||||
|
@ -42,19 +42,24 @@ while test -z "$ok"; do
|
||||||
ok=yes
|
ok=yes
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "${deftag}" != "${tagpfx}" ]]; then
|
if [ "${deftag}" != "${tagpfx}" ]; then
|
||||||
echo -e "Using new tag \e[94m${this_tag}\e[0m according to pattern in cosmos.conf"
|
echo -e "Using new tag \e[94m${this_tag}\e[0m according to pattern in cosmos.conf"
|
||||||
else
|
else
|
||||||
echo -e "Using new tag \e[94m${this_tag}\e[0m"
|
echo -e "Using new tag \e[94m${this_tag}\e[0m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\e[1mONLY SIGN IF YOU APPROVE OF VERIFICATION AND DIFF ABOVE\e[0m"
|
echo -e "\e[1mONLY SIGN IF YOU APPROVE OF VERIFICATION AND DIFF ABOVE\e[0m"
|
||||||
|
else
|
||||||
|
echo -e "\e[1mCOULD NOT FIND LAST TAG, ASSUMING NEW TAG\e[0m"
|
||||||
|
iter=1
|
||||||
|
this_tag=$(date "+${tagpfx}-%Y-%m-%d-v$(printf "%02d" ${iter})")
|
||||||
|
fi
|
||||||
|
|
||||||
# GITTAGEXTRA is for putting things like "-u 2117364A"
|
# GITTAGEXTRA is for putting things like "-u 2117364A"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
git tag ${GITTAGEXTRA} -m bump. -s "${this_tag}"
|
git tag ${GITTAGEXTRA} -s "${this_tag}" -m bump.
|
||||||
|
|
||||||
git push
|
git push
|
||||||
git push --tags
|
git push --tags
|
||||||
|
|
Loading…
Reference in a new issue