1*ab625e41SAndroid Build Coastguard Worker#!/bin/bash 2*ab625e41SAndroid Build Coastguard Worker 3*ab625e41SAndroid Build Coastguard Workerset -ex 4*ab625e41SAndroid Build Coastguard Worker 5*ab625e41SAndroid Build Coastguard WorkerREPO="[email protected]:square/okio.git" 6*ab625e41SAndroid Build Coastguard WorkerGROUP_ID="com.squareup.okio" 7*ab625e41SAndroid Build Coastguard WorkerARTIFACT_ID="okio" 8*ab625e41SAndroid Build Coastguard Worker 9*ab625e41SAndroid Build Coastguard WorkerDIR=temp-clone 10*ab625e41SAndroid Build Coastguard Worker 11*ab625e41SAndroid Build Coastguard Worker# Delete any existing temporary website clone 12*ab625e41SAndroid Build Coastguard Workerrm -rf $DIR 13*ab625e41SAndroid Build Coastguard Worker 14*ab625e41SAndroid Build Coastguard Worker# Clone the current repo into temp folder 15*ab625e41SAndroid Build Coastguard Workergit clone $REPO $DIR 16*ab625e41SAndroid Build Coastguard Worker 17*ab625e41SAndroid Build Coastguard Worker# Move working directory into temp folder 18*ab625e41SAndroid Build Coastguard Workercd $DIR 19*ab625e41SAndroid Build Coastguard Worker 20*ab625e41SAndroid Build Coastguard Worker# Checkout and track the gh-pages branch 21*ab625e41SAndroid Build Coastguard Workergit checkout -t origin/gh-pages 22*ab625e41SAndroid Build Coastguard Worker 23*ab625e41SAndroid Build Coastguard Worker# Delete everything 24*ab625e41SAndroid Build Coastguard Workerrm -rf * 25*ab625e41SAndroid Build Coastguard Worker 26*ab625e41SAndroid Build Coastguard Worker# Download the latest javadoc 27*ab625e41SAndroid Build Coastguard Workercurl -L "https://search.maven.org/remote_content?g=$GROUP_ID&a=$ARTIFACT_ID&v=LATEST&c=javadoc" > javadoc.zip 28*ab625e41SAndroid Build Coastguard Workerunzip javadoc.zip 29*ab625e41SAndroid Build Coastguard Workerrm javadoc.zip 30*ab625e41SAndroid Build Coastguard Worker 31*ab625e41SAndroid Build Coastguard Worker# Stage all files in git and create a commit 32*ab625e41SAndroid Build Coastguard Workergit add . 33*ab625e41SAndroid Build Coastguard Workergit add -u 34*ab625e41SAndroid Build Coastguard Workergit commit -m "Website at $(date)" 35*ab625e41SAndroid Build Coastguard Worker 36*ab625e41SAndroid Build Coastguard Worker# Push the new files up to GitHub 37*ab625e41SAndroid Build Coastguard Workergit push origin gh-pages 38*ab625e41SAndroid Build Coastguard Worker 39*ab625e41SAndroid Build Coastguard Worker# Delete our temp folder 40*ab625e41SAndroid Build Coastguard Workercd .. 41*ab625e41SAndroid Build Coastguard Workerrm -rf $DIR 42