1
1
#! /usr/bin/env bash
2
2
3
- cd ` dirname $0 ` /..
4
-
5
3
setup_git () {
6
- git config --global user.email
" [email protected] "
7
- git config --global user.name " Travis CI"
4
+ echo " Setting up git config"
5
+ git config --global user.email
" [email protected] "
6
+ git config --global user.name " Travis CI"
8
7
}
9
8
10
9
update_version () {
11
- # Push the new tag with `-SNAPSHOT` as the current version
10
+ echo " Updating the version in the POMs"
11
+
12
+ # Push the tag with `-SNAPSHOT` as the current version
12
13
mvn --settings .travis/settings.xml org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion=" ${TRAVIS_TAG} -SNAPSHOT"
13
14
14
15
# Increment the patch version
15
16
mvn --settings .travis/settings.xml release:update-versions -B
16
17
17
- # Pull the value from the pom
18
+ # Pull the new value from the pom
18
19
NEW_VERSION=$( mvn --settings .travis/settings.xml help:evaluate -Dexpression=project.version -q -DforceStdout)
19
20
}
20
21
21
22
commit_files () {
23
+ echo " Commiting the changes to git"
22
24
23
- # Use the version as the branch name
24
- git checkout -b ${NEW_VERSION}
25
+ # Use the version as the branch name
26
+ git checkout -b ${NEW_VERSION}
25
27
26
- # Stage the modified files
27
- git add pom.xml * /pom.xml
28
+ # Stage the modified files
29
+ git add ./ pom.xml ./ * /pom.xml
28
30
29
- # Create a new commit with a custom build message and Travis build number for reference
30
- git commit -m " build: $NEW_VERSION (Travis Build $TRAVIS_BUILD_NUMBER )"
31
+ # Print the current files we are going to commit
32
+ git status
33
+
34
+ # Create a new commit with a custom build message and Travis build number for reference
35
+ git commit -m " build: $NEW_VERSION (Travis Build $TRAVIS_BUILD_NUMBER )"
31
36
}
32
37
33
38
upload_files () {
39
+ echo " Pushing the changes to git remote"
34
40
35
- tokenLink=" https://${GITHUB_TOKEN} @github.com/ExpediaDotCom/graphql-kotlin.git"
41
+ tokenLink=" https://${GITHUB_TOKEN} @github.com/ExpediaDotCom/graphql-kotlin.git"
36
42
37
- # Add new "origin" with access token in the git URL for authentication
38
- git remote add token-origin ${tokenLink} > /dev/null 2>&1
43
+ # Add new "origin" with access token in the git URL for authentication
44
+ git remote add token-origin ${tokenLink} > /dev/null 2>&1
39
45
40
- # Push changes to the new branch
41
- git push --quiet --set-upstream token-origin ${NEW_VERSION}
46
+ # Push changes to the new branch
47
+ git push --quiet --set-upstream token-origin ${NEW_VERSION}
42
48
43
- # Remove the origin to hide the token
44
- git remote rm token-origin > /dev/null 2>&1
49
+ # Remove the origin to hide the token
50
+ git remote rm token-origin > /dev/null 2>&1
45
51
}
46
52
47
53
if [[ -z " $TRAVIS_TAG " ]]
58
64
59
65
NEW_VERSION=" "
60
66
67
+ cd ` dirname $0 ` /..
68
+
69
+ pwd
70
+
61
71
setup_git
62
72
63
73
update_version
@@ -66,11 +76,7 @@ commit_files
66
76
67
77
# Attempt to push to git only if "git commit" succeeded
68
78
if [[ $? -eq 0 ]]; then
69
- echo " Uploading to GitHub"
70
79
upload_files
71
80
else
72
- echo " Nothing to do "
81
+ echo " No files commited. Not pushing anything to git. "
73
82
fi
74
-
75
-
76
-
0 commit comments