Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Commit

Permalink
cleanup log
Browse files Browse the repository at this point in the history
  • Loading branch information
abranhe committed Jul 11, 2018
1 parent 6f7609a commit 5bbf26d
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
arg1=$1
arg2=$2
arg3=$3
all=${@:2}
all=${@}

# Colors
RESET="\033[0m"
Expand Down Expand Up @@ -71,6 +71,12 @@ function checkStatus() {
fi
}

# Save log
function saveLog()
{
${@}>>log
}

# GITHUB-NPM
function logo()
{
Expand All @@ -95,36 +101,39 @@ ${WHITE}See 'github-npm --help' for more information${RESET}"

function publishToNPM()
{
git checkout master
npm install
npm version ${arg1}
git add . # package.json and package-lock.json should change
saveLog git checkout master

saveLog npm install

saveLog npm version ${arg1}
saveLog git add package.json package-lock.json # package.json and package-lock.json should change

if [ -z "${arg2}" ]; then
# Default commit
git commit -m "${PACKAGE_VERSION} published"
saveLog git commit -m "${PACKAGE_VERSION} published"
elif [[ "${arg2}" =~ "-m" ]]; then
if [ -z "${arg3}" ]; then
echo -e "${RED}Must have a commit message${RESET}"
else
git commit -m "${arg3}"
saveLog git commit -m "${arg3}"
fi
fi

# Publish package
npm publish
echo -e "$(message "Publishing package")"
saveLog npm publish
saveLog echo -e "$(message "Publishing package")"

# Push commits
git push origin master
saveLog git push origin master

# Tag version
git tag -a "v${PACKAGE_VERSION}" -m "Welcome to ${PACKAGE_VERSION version}"
git push origin --tags
echo -e "$(message "Creating tags")"
saveLog git tag -a "v${PACKAGE_VERSION}" -m "Welcome to ${PACKAGE_VERSION version}"
saveLog git push origin --tags
saveLog echo -e "$(message "Creating tags")"

}


function message ()
{
echo "\033[1K"
Expand All @@ -136,11 +145,11 @@ ${GREEN}✔︎ "$@" ${RESET}
#-------------------------- End of Helper --------------------------------------


# Check if there are changes to be committed
if ! $(checkStatus); then
echo -e "${RED}✖︎ Please commit your changes before creating a release${RESET}"
exit 0
fi
# # Check if there are changes to be committed
# if ! $(checkStatus); then
# echo -e "${RED}✖︎ Please commit your changes before creating a release${RESET}"
# exit 0
# fi


# Commands
Expand Down

0 comments on commit 5bbf26d

Please sign in to comment.