| Narayan Kamath | 166772b | 2013-11-04 16:04:55 +0000 | [diff] [blame] | 1 | #!/bin/bash | 
|  | 2 |  | 
|  | 3 | set -ex | 
|  | 4 |  | 
|  | 5 | REPO="git@github.com:square/okhttp.git" | 
|  | 6 | GROUP_ID="com.squareup.okhttp" | 
|  | 7 | ARTIFACT_ID="okhttp" | 
|  | 8 |  | 
|  | 9 | DIR=temp-clone | 
|  | 10 |  | 
|  | 11 | # Delete any existing temporary website clone | 
|  | 12 | rm -rf $DIR | 
|  | 13 |  | 
|  | 14 | # Clone the current repo into temp folder | 
|  | 15 | git clone $REPO $DIR | 
|  | 16 |  | 
|  | 17 | # Move working directory into temp folder | 
|  | 18 | cd $DIR | 
|  | 19 |  | 
|  | 20 | # Checkout and track the gh-pages branch | 
|  | 21 | git checkout -t origin/gh-pages | 
|  | 22 |  | 
|  | 23 | # Delete everything | 
|  | 24 | rm -rf * | 
|  | 25 |  | 
|  | 26 | # Copy website files from real repo | 
|  | 27 | cp -R ../website/* . | 
|  | 28 |  | 
|  | 29 | # Download the latest javadoc | 
|  | 30 | curl -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 | 
|  | 31 | mkdir javadoc | 
|  | 32 | unzip javadoc.zip -d javadoc | 
|  | 33 | rm javadoc.zip | 
|  | 34 |  | 
|  | 35 | # Stage all files in git and create a commit | 
|  | 36 | git add . | 
|  | 37 | git add -u | 
|  | 38 | git commit -m "Website at $(date)" | 
|  | 39 |  | 
|  | 40 | # Push the new files up to GitHub | 
|  | 41 | git push origin gh-pages | 
|  | 42 |  | 
|  | 43 | # Delete our temp folder | 
|  | 44 | cd .. | 
|  | 45 | rm -rf $DIR |