forked from ibm-developer/generator-ibm-service-enablement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
npm_version_upgrade.sh
executable file
·32 lines (26 loc) · 1.09 KB
/
npm_version_upgrade.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
set -ev
echo "Auto version updating script : version 0.0.1"
echo "Checking if a new version update is required ..."
PKG_NAME=`node -e "console.log(require('./package.json').name);"`
export PKG_VER=`node -e "console.log(require('./package.json').version);"`
export NPM_VER=`npm show $PKG_NAME version`
echo "$PKG_NAME : version = $PKG_VER, npm version = $NPM_VER"
HTML=$(markdown CHANGELOG.md)
if [ $TRAVIS_BRANCH = "master" ]; then
echo "Build targetting master - checking if this is a PR or not"
if [[ "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
echo "This is a build on master, performing additional steps"
if [ $NPM_VER == $PKG_VER ]; then
echo "Version numbers match, so changing version and committing changes"
./prerelease.sh
retval=$?
if [[ $retval != 0 ]]; then
exit $retval
fi
else
npm publish
node /tmp/changelog-generator-slack-notification/index.js --html "$HTML" --name "$PKG_NAME" --api "$SLACK_WEBHOOK" --v "$PKG_VER"
fi
fi
fi