forked from ibm-developer/generator-ibm-service-enablement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
npm_patch.sh
executable file
·38 lines (31 loc) · 1.44 KB
/
npm_patch.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
33
34
35
36
37
38
#!/usr/bin/env bash
set -ev
if [[ "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
echo "Not a Pull Request build. Proceeding."
# on development branch, we want to auto increment package patch version number
# and push commit back to repo
if [[ "${TRAVIS_BRANCH}" = "development" ]]; then
echo "On development branch"
echo "Commit message: ${TRAVIS_COMMIT_MESSAGE}"
if [[ "${TRAVIS_COMMIT_MESSAGE}" == "[Travis - npm version patch]"* ]]; then
echo "This is a version increment commit. Doing nothing."
else
echo "Incrementing patch version and pushing back to repo."
echo "commit: ${TRAVIS_COMMIT}"
USER_EMAIL=$(git --no-pager show -s --format='%ae' "${TRAVIS_COMMIT}")
USER_NAME=$(git --no-pager show -s --format='%an' "${TRAVIS_COMMIT}")
echo "user email: ${USER_EMAIL}"
echo "user name: ${USER_NAME}"
git config user.email "${USER_EMAIL}"
git config user.name "${USER_NAME}"
git checkout -- .
git checkout -b increment-patch-version
npm version patch -m "[Travis - npm version patch] Increment package version to %s"
git branch --set-upstream-to origin/development
git push $GITHUB_URL_SECURED HEAD:development
git push $GITHUB_URL_SECURED HEAD:development --tags
fi
fi
else
echo "This is a Pull Request build. Doing nothing."
fi