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 9 REPO="git (at] github.com:square/dagger.git" 10 GROUP_ID="com.squareup.dagger" 11 ARTIFACT_ID="dagger" 12 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 19 git clone $REPO $DIR 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 28 rm -rf * 29 30 # Copy website files from real repo 31 cp -R ../website/* . 32 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 39 # Stage all files in git and create a commit 40 git add . 41 git add -u 42 git commit -m "Website at $(date)" 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 50