forked from square/keywhiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·49 lines (36 loc) · 1.15 KB
/
deploy.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
#!/bin/bash
set -ex
REPO="[email protected]:square/keywhiz.git"
GROUP_ID="com.squareup.keywhiz"
# Create a temp directory
DIR=`mktemp -d temp-clone-XXXXX`
# Build keywhiz-server for API docs
mvn package -am -DskipTests -pl server
# Clone the current repo into temp folder
git clone $REPO $DIR
# Move working directory into temp folder
cd $DIR
# Checkout and track the gh-pages branch
git checkout -t origin/gh-pages
# Delete everything
rm -rf *
# Copy website files from real repo
cp -R ../website/* .
# Download the latest javadoc to directories like 'javadoc-server' or 'javadoc-client'.
for DOCUMENTED_ARTIFACT in keywhiz-server keywhiz-client keywhiz-api keywhiz-model keywhiz-hkdf keywhiz-testing
do
curl -L "https://search.maven.org/remote_content?g=$GROUP_ID&a=$DOCUMENTED_ARTIFACT&v=LATEST&c=javadoc" > javadoc.zip
JAVADOC_DIR="javadoc${DOCUMENTED_ARTIFACT//keywhiz/}"
mkdir $JAVADOC_DIR
unzip javadoc.zip -d $JAVADOC_DIR
rm javadoc.zip
done
# Stage all files in git and create a commit
git add .
git add -u
git commit -m "Website at $(date)"
# Push the new files up to GitHub
git push origin gh-pages
# Delete our temp folder
cd ..
rm -rf $DIR