1#!/bin/bash
2
3set -ex
4
5REPO="git@github.com:square/okio.git"
6GROUP_ID="com.squareup.okio"
7ARTIFACT_ID="okio"
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# Download the latest javadoc
27curl -L "https://search.maven.org/remote_content?g=$GROUP_ID&a=$ARTIFACT_ID&v=LATEST&c=javadoc" > javadoc.zip
28unzip javadoc.zip
29rm javadoc.zip
30
31# Stage all files in git and create a commit
32git add .
33git add -u
34git commit -m "Website at $(date)"
35
36# Push the new files up to GitHub
37git push origin gh-pages
38
39# Delete our temp folder
40cd ..
41rm -rf $DIR
42