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