Files
cgm-remote-monitor/bin/prep_repo_release.sh
T
Ben West 3bb4f6be01 move script for repo maintenance aside
This script is used to help prep release branches and tags.  Since it's not
crucial to the business of remote monitoring and only useful as a maintenance
tool, we're moving it away from the project root.
2021-02-18 09:52:11 -08:00

34 lines
781 B
Bash
Executable File

#!/bin/bash
set -ueE
function update ( ) {
upgrade=$1
npm version $upgrade || exit 255
}
RELEASE_NOTES="Release.md"
TYPE=${1-'patch'}
echo "First update"
npm ls . || echo -n ""
NEW_TAG=$(update ${TYPE})
echo "Updating to $NEW_TAG"
# npm commits a new package json on your behalf with a new tag pointed at it
git reset --hard HEAD~1
git tag -d $NEW_TAG || echo "warning ${NEW_TAG} not present"
BRANCH_NAME="release/${NEW_TAG}"
git checkout -b ${BRANCH_NAME}
npm ls . || echo -n ""
cat /dev/null > ${RELEASE_NOTES}
git changelog -t ${NEW_TAG} ${RELEASE_NOTES}
echo "saving release notes"
git add ${RELEASE_NOTES}
git commit -vm "Release notes for ${NEW_TAG}"
echo "Final update"
update ${TYPE}
echo "New version $NEW_TAG"
echo "Branch ${BRANCH_NAME}"
npm ls . || echo -n ""