Skip to content

Commit bdf6e58

Browse files
author
Nicolai Parlog
committed
Include commit hashes of sources and projects in commit message
1 parent 0f854d5 commit bdf6e58

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ script:
1414

1515
deploy:
1616
provider: script
17-
script: ./gradlew pushSite --no-daemon --stacktrace
17+
script: ./gradlew pushSite --no-daemon --stacktrace -Pon-travis=true
1818
skip_cleanup: true
1919
on:
2020
branch: grandmaster

build.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// SETUP
33
// -----
44

5+
ext {
6+
onTravis = project.findProperty('on-travis') == "true"
7+
}
8+
59
configure(rootProject) {
610

711
task wrapper(type: Wrapper) {
@@ -18,7 +22,7 @@ task setupGitOnTravis(type: Exec) {
1822

1923
task setupGitRepo(type: Exec) {
2024
commandLine './git-repo-setup.sh'
21-
if (project.findProperty('on-travis'))
25+
if (onTravis)
2226
dependsOn setupGitOnTravis
2327
}
2428

@@ -122,7 +126,10 @@ task buildSite(type: Exec) {
122126
}
123127

124128
task pushSite(type: Exec) {
125-
commandLine './git-commit-push.sh site'.split(' ')
129+
if (onTravis)
130+
commandLine './git-commit-push.sh launch-ssh'.split(' ')
131+
else
132+
commandLine './git-commit-push.sh'
126133
}
127134

128135
task publishSite {

git-commit-push.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,23 @@
33
# exit with nonzero exit code if anything fails
44
set -e
55

6-
# SSH agent was shut down, so start it again, adding the deploy key
7-
eval `ssh-agent -s`
8-
ssh-add deploy-key
6+
# on Travis, SSH agent was shut down, so start it again, adding the deploy key
7+
if [ "$1" == "launch-ssh" ]
8+
then
9+
eval `ssh-agent -s`
10+
ssh-add deploy-key
11+
fi
12+
13+
# gather hashes for commit message
14+
cd site-source
15+
SOURCE_HASH="$(git rev-parse --short HEAD)"
16+
cd ../junit-pioneer
17+
XP_HASH="$(git rev-parse --short HEAD)"
18+
cd ..
919

1020
# now commit and push
11-
cd $1
21+
cd site
1222
git add --all
13-
git commit -m "Update site"
23+
# echo "Update to source $SOURCE_HASH, xp $XP_HASH"
24+
git commit -m "Update to source $SOURCE_HASH, xp $XP_HASH"
1425
git push

0 commit comments

Comments
 (0)