Skip to content

Commit 0f854d5

Browse files
author
Nicolai Parlog
committed
Make Travis build the site
1 parent 1a5be7b commit 0f854d5

File tree

7 files changed

+45
-14
lines changed

7 files changed

+45
-14
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ site/
22
site-source/
33
.gradle/
44
junit-pioneer/
5+
6+
deploy-key

.travis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,11 @@ install:
1010
- ./gradlew setup --no-daemon --stacktrace -Pon-travis=true
1111

1212
script:
13-
- tree
13+
- ./gradlew buildSite --no-daemon --stacktrace
14+
15+
deploy:
16+
provider: script
17+
script: ./gradlew pushSite --no-daemon --stacktrace
18+
skip_cleanup: true
19+
on:
20+
branch: grandmaster

build.gradle

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ configure(rootProject) {
1212

1313
}
1414

15-
task setupGitRepoOnTravis(type: Exec) {
16-
commandLine './git-repo-travis-setup.sh'
15+
task setupGitOnTravis(type: Exec) {
16+
commandLine './git-travis-setup.sh'
1717
}
1818

1919
task setupGitRepo(type: Exec) {
2020
commandLine './git-repo-setup.sh'
2121
if (project.findProperty('on-travis'))
22-
dependsOn setupGitRepoOnTravis
22+
dependsOn setupGitOnTravis
2323
}
2424

2525
task setupJekyll(type: Exec) {
@@ -124,3 +124,8 @@ task buildSite(type: Exec) {
124124
task pushSite(type: Exec) {
125125
commandLine './git-commit-push.sh site'.split(' ')
126126
}
127+
128+
task publishSite {
129+
dependsOn buildSite, pushSite
130+
pushSite.mustRunAfter(buildSite)
131+
}

deploy-key.enc

3.17 KB
Binary file not shown.

git-commit-push.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
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
9+
10+
# now commit and push
611
cd $1
712
git add --all
813
git commit -m "Update site"

git-repo-travis-setup.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

git-travis-setup.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# exit with nonzero exit code if anything fails
4+
set -e
5+
6+
git config user.name "Travis CI"
7+
git config user.email "[email protected]"
8+
9+
# decrypt the deploy key and add to SSH agent;
10+
# this makes the repo read-write-accessible via SSH
11+
openssl aes-256-cbc -K $encrypted_4eabd460f39b_key -iv $encrypted_4eabd460f39b_iv -in deploy-key.enc -out deploy-key -d
12+
chmod 600 deploy-key
13+
eval `ssh-agent -s`
14+
ssh-add deploy-key
15+
16+
# make the remote available via SSH, so it can be pushed to later
17+
git remote set-url origin [email protected]:junit-pioneer/junit-pioneer.github.io.git
18+
# fetch all the remote branches; travis clones with `--depth`, which implies
19+
# `--single-branch`, so we need to overwrite remote.origin.fetch to do that
20+
# (source: https://stackoverflow.com/a/44036486/2525313)
21+
git config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
22+
git fetch --depth=5

0 commit comments

Comments
 (0)