1#!/bin/bash
2
3set -ex
4
5REPO="git@github.com:square/okhttp.git"
6GROUP_ID="com.squareup.okhttp"
7ARTIFACT_ID="okhttp"
8
9DIR=temp-clone
10
11# Delete any existing temporary website clone
12rm -rf $DIR
13
14# Clone the current repo into temp folder
15git clone $REPO $DIR
16
17# Move working directory into temp folder
18cd $DIR
19
20# Checkout and track the gh-pages branch
21git checkout -t origin/gh-pages
22
23# Delete everything
24rm -rf *
25
26# Copy website files from real repo
27cp -R ../website/* .
28
29# Download the latest javadoc
30curl -L "http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=$GROUP_ID&a=$ARTIFACT_ID&v=LATEST&c=javadoc" > javadoc.zip
31mkdir javadoc
32unzip javadoc.zip -d javadoc
33rm javadoc.zip
34
35# Stage all files in git and create a commit
36git add .
37git add -u
38git commit -m "Website at $(date)"
39
40# Push the new files up to GitHub
41git push origin gh-pages
42
43# Delete our temp folder
44cd ..
45rm -rf $DIR
46