Jake Wharton | e8586ef | 2012-11-07 11:30:43 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Deploys the current Dagger website to the gh-pages branch of the GitHub |
| 4 | # repository. To test the site locally before deploying run `jekyll --server` |
| 5 | # in the website/ directory. |
| 6 | |
| 7 | set -ex |
| 8 | |
Jake Wharton | 05b5569 | 2013-05-07 10:26:02 -0700 | [diff] [blame] | 9 | REPO="git@github.com:square/dagger.git" |
| 10 | GROUP_ID="com.squareup.dagger" |
| 11 | ARTIFACT_ID="dagger" |
| 12 | |
Jake Wharton | e8586ef | 2012-11-07 11:30:43 -0800 | [diff] [blame] | 13 | DIR=temp-dagger-clone |
| 14 | |
| 15 | # Delete any existing temporary website clone |
| 16 | rm -rf $DIR |
| 17 | |
| 18 | # Clone the current repo into temp folder |
Jake Wharton | 05b5569 | 2013-05-07 10:26:02 -0700 | [diff] [blame] | 19 | git clone $REPO $DIR |
Jake Wharton | e8586ef | 2012-11-07 11:30:43 -0800 | [diff] [blame] | 20 | |
| 21 | # Move working directory into temp folder |
| 22 | cd $DIR |
| 23 | |
| 24 | # Checkout and track the gh-pages branch |
| 25 | git checkout -t origin/gh-pages |
| 26 | |
| 27 | # Delete everything |
Jake Wharton | f351d67 | 2012-11-07 13:00:06 -0800 | [diff] [blame] | 28 | rm -rf * |
Jake Wharton | e8586ef | 2012-11-07 11:30:43 -0800 | [diff] [blame] | 29 | |
| 30 | # Copy website files from real repo |
| 31 | cp -R ../website/* . |
| 32 | |
Jake Wharton | 05b5569 | 2013-05-07 10:26:02 -0700 | [diff] [blame] | 33 | # Download the latest javadoc |
| 34 | 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 |
| 35 | mkdir javadoc |
| 36 | unzip javadoc.zip -d javadoc |
| 37 | rm javadoc.zip |
| 38 | |
Jake Wharton | e8586ef | 2012-11-07 11:30:43 -0800 | [diff] [blame] | 39 | # Stage all files in git and create a commit |
| 40 | git add . |
Jake Wharton | f351d67 | 2012-11-07 13:00:06 -0800 | [diff] [blame] | 41 | git add -u |
Jake Wharton | 7f98b59 | 2012-11-07 13:50:17 -0800 | [diff] [blame] | 42 | git commit -m "Website at $(date)" |
Jake Wharton | e8586ef | 2012-11-07 11:30:43 -0800 | [diff] [blame] | 43 | |
| 44 | # Push the new files up to GitHub |
| 45 | git push origin gh-pages |
| 46 | |
| 47 | # Delete our temp folder |
| 48 | cd .. |
| 49 | rm -rf $DIR |