From 7b8f19446631eb091fad5a8ed40a67ecd83e9320 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Thu, 28 Mar 2024 01:39:23 +0100 Subject: [PATCH] Add git-realese script --- git-release | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 git-release diff --git a/git-release b/git-release new file mode 100755 index 0000000..55daacd --- /dev/null +++ b/git-release @@ -0,0 +1,32 @@ +#!/bin/bash + +declare -r VERSION=${1} +declare -r MESSAGE=${2} +declare -r TAGBRANCH=main +declare CURRENTBRANCH="" + +showHelp() { + echo git-release version +} + +if [ "${VERSION}" == "" ]; then + showHelp + echo "" + echo "no version provided!" + exit 1 +fi + +CURRENTBRANCH=$(git rev-parse --abbrev-ref HEAD) + +if [ ! "${CURRENTBRANCH}" == "dev" ]; then + echo "You are not in dev branch!" + echo "Use dev branch to make a release!" + exit 1 +fi + +git checkout "${TAGBRANCH}" +git merge "${CURRENTBRANCH}" +git push +git tag -a "${VERSION}" -m "${MESSAGE}" +git push --tags +git checkout "${CURRENTBRANCH}"