-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgh-pages.sh
executable file
·70 lines (53 loc) · 1.24 KB
/
gh-pages.sh
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Script to build and push the showcase to branch 'gh-pages'
#
# Prerequisites
# - Clean git status (no uncommitted changes in current branch)
#
# Parameters
# 1. No parameters
#
# What it does
# 1. Assemble showcase
# 2. Push showcase to branch 'gh-pages'
ROOT=$PWD
BRANCH=$(git symbolic-ref -q HEAD)
BRANCH=${BRANCH##refs/heads/}
BRANCH=${BRANCH:-HEAD}
function box()
{
local s="$*"
tput setaf 3
echo
echo
echo
echo " -${s//?/-}-
| ${s//?/ } |
| $(tput setaf 4)$s$(tput setaf 3) |
| ${s//?/ } |
-${s//?/-}-"
tput sgr 0
}
# Prerequisites
if ! git diff --no-ext-diff --quiet --exit-code; then
echo "Cannot deploy to gh-pages. You have uncommitted changes in the current branch."
exit 1
fi
# Build showcase
box "Build showcase"
./gradlew assemble
# Push showcase to gh-pages
rm -rf /tmp/patternfly-fritz2-showcase
cd /tmp/
git clone -b gh-pages --single-branch [email protected]:patternfly-kotlin/patternfly-fritz2-showcase.git
cd patternfly-fritz2-showcase
box "Push showcase to gh-pages"
rm -rf *
cp -R ${ROOT}/build/distributions/* .
date > .build
git add --all
git commit -am "Update showcase"
git push -f origin gh-pages
cd ${ROOT}
# Done
box " <<--== Showcase successfully build and published. ==-->> "