Skip to content

Commit 5af896d

Browse files
authored
Add debug logging to update-versions.sh (ExpediaGroup#279)
* Add debug logging to update-versions.sh Add some more logging to the script because running the steps locally performs the correct changes * print git status info
1 parent c431a63 commit 5af896d

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

.travis/update-version.sh

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,53 @@
11
#!/usr/bin/env bash
22

3-
cd `dirname $0`/..
4-
53
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"
87
}
98

109
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
1213
mvn --settings .travis/settings.xml org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion="${TRAVIS_TAG}-SNAPSHOT"
1314

1415
# Increment the patch version
1516
mvn --settings .travis/settings.xml release:update-versions -B
1617

17-
# Pull the value from the pom
18+
# Pull the new value from the pom
1819
NEW_VERSION=$(mvn --settings .travis/settings.xml help:evaluate -Dexpression=project.version -q -DforceStdout)
1920
}
2021

2122
commit_files() {
23+
echo "Commiting the changes to git"
2224

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}
2527

26-
# Stage the modified files
27-
git add pom.xml */pom.xml
28+
# Stage the modified files
29+
git add ./pom.xml ./*/pom.xml
2830

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)"
3136
}
3237

3338
upload_files() {
39+
echo "Pushing the changes to git remote"
3440

35-
tokenLink="https://${GITHUB_TOKEN}@github.com/ExpediaDotCom/graphql-kotlin.git"
41+
tokenLink="https://${GITHUB_TOKEN}@github.com/ExpediaDotCom/graphql-kotlin.git"
3642

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
3945

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}
4248

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
4551
}
4652

4753
if [[ -z "$TRAVIS_TAG" ]]
@@ -58,6 +64,10 @@ fi
5864

5965
NEW_VERSION=""
6066

67+
cd `dirname $0`/..
68+
69+
pwd
70+
6171
setup_git
6272

6373
update_version
@@ -66,11 +76,7 @@ commit_files
6676

6777
# Attempt to push to git only if "git commit" succeeded
6878
if [[ $? -eq 0 ]]; then
69-
echo "Uploading to GitHub"
7079
upload_files
7180
else
72-
echo "Nothing to do"
81+
echo "No files commited. Not pushing anything to git."
7382
fi
74-
75-
76-

0 commit comments

Comments
 (0)