Skip to content

Commit 54983ec

Browse files
author
Nicolai Parlog
committed
Publish site with GitHub Actions
1 parent 708bd43 commit 54983ec

File tree

7 files changed

+55
-66
lines changed

7 files changed

+55
-66
lines changed

.github/workflows/actions.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: JUnit Pioneer Site
2+
3+
on:
4+
push:
5+
branches: [ grandmaster, site-source ]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out repo
12+
uses: actions/checkout@v2
13+
- name: Set up Ruby
14+
uses: actions/setup-ruby@v1
15+
with:
16+
ruby-version: 2.5
17+
- name: Set up Java
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: '8'
21+
- name: Versions
22+
run: |
23+
ruby -v
24+
bundler -v
25+
java -version
26+
- name: "Gradle: setup"
27+
run: ./gradlew setup --no-daemon --stacktrace
28+
- name: "Gradle: build site"
29+
run: ./gradlew buildSite --no-daemon --stacktrace
30+
- name: "Gradle: publish site"
31+
run: ./gradlew pushSite --no-daemon --stacktrace

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
.gradle/
2+
.idea/
3+
.settings/
4+
.project
5+
16
site/
27
site-source/
3-
.gradle/
48
junit-pioneer/
59
junit-pioneer
6-
7-
deploy-key

.travis.yml

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

build.gradle

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// -----
44

55
ext {
6-
onTravis = project.findProperty('on-travis') == "true"
6+
onCi = System.getenv("CI")
77
}
88

99
configure(rootProject) {
@@ -16,14 +16,14 @@ configure(rootProject) {
1616

1717
}
1818

19-
task setupGitOnTravis(type: Exec) {
20-
commandLine './git-travis-setup.sh'
19+
task setupGitOnCi(type: Exec) {
20+
commandLine './git-ci-setup.sh'
2121
}
2222

2323
task setupGitRepo(type: Exec) {
2424
commandLine './git-repo-setup.sh'
25-
if (onTravis)
26-
dependsOn setupGitOnTravis
25+
if (onCi)
26+
dependsOn setupGitOnCi
2727
}
2828

2929
task setupJekyll(type: Exec) {
@@ -112,20 +112,12 @@ task buildSite(type: Exec) {
112112
commandLine 'bundle exec jekyll build --destination ../site'.split(' ')
113113
}
114114

115-
task buildJavadoc(type: Exec) {
116-
workingDir 'junit-pioneer'
117-
commandLine './gradlew javadoc --no-daemon'.split(' ')
118-
}
119-
120115
// -------
121116
// PUBLISH
122117
// -------
123118

124119
task pushSite(type: Exec) {
125-
if (onTravis)
126-
commandLine './git-commit-push.sh launch-ssh'.split(' ')
127-
else
128-
commandLine './git-commit-push.sh'
120+
commandLine './git-commit-push.sh'
129121
}
130122

131123
task publishSite {

git-ci-setup.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# exit with nonzero exit code if anything fails
4+
set -e
5+
6+
git config user.name "GitHub Actions"
7+
git config user.email "[email protected]"
8+
9+
# fetch all the remote branches; travis clones with `--depth`, which implies
10+
# `--single-branch`, so we need to overwrite remote.origin.fetch to do that
11+
# (source: https://stackoverflow.com/a/44036486/2525313)
12+
git config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
13+
git fetch --depth=5

git-commit-push.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
# exit with nonzero exit code if anything fails
44
set -e
55

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-
136
# gather hashes for commit message
147
cd site-source
158
SOURCE_HASH="$(git rev-parse --short HEAD)"

git-travis-setup.sh

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

0 commit comments

Comments
 (0)