-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·49 lines (38 loc) · 1.14 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -e
info="$(./info)"
echo "$info"
ref="$(git describe --all --long HEAD)"
if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
exit 0
fi
build_name="$(uname | tr A-Z a-z)"
if [ "$build_name" == "linux" ] && [ "$(sudo -n -v 2>&1)" == "" ]; then
build_name="$build_name-docker"
fi
current_branch="$(git symbolic-ref --short -q HEAD || echo "$TRAVIS_BRANCH")"
if [ "$current_branch" != "master" ] && [ "$current_branch" != "$build_name" ]; then
exit 0
fi
outdir="$(mktemp -d -t machineinfo-XXXXXX)"
git remote set-branches --add origin gh-pages
git fetch --all
git branch --track gh-pages origin/gh-pages
git clone --branch gh-pages $(pwd) $outdir
host="$(hostname -f)"
(
export GIT_AUTHOR_NAME="$(git log -n 1 --format='%an')"
export GIT_AUTHOR_EMAIL="$(git log -n 1 --format='%ae')"
export GIT_COMMITTER_NAME="Travis CI"
export GIT_COMMITTER_EMAIL="travis-ci@$host"
cd $outdir
echo "---
layout: default
tags: machineinfo
---
$info" > "${build_name}/index.md"
git add "${build_name}/index.md"
git commit -m"System info $host build with $ref"
git push origin gh-pages
)
git push origin gh-pages