blob: 1fde1bd5760cd6bf664bcada25292ac10fb1732f [file] [log] [blame]
Jake Whartone8586ef2012-11-07 11:30:43 -08001#!/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
7set -ex
8
Jake Wharton05b55692013-05-07 10:26:02 -07009REPO="git@github.com:square/dagger.git"
10GROUP_ID="com.squareup.dagger"
11ARTIFACT_ID="dagger"
12
Jake Whartone8586ef2012-11-07 11:30:43 -080013DIR=temp-dagger-clone
14
15# Delete any existing temporary website clone
16rm -rf $DIR
17
18# Clone the current repo into temp folder
Jake Wharton05b55692013-05-07 10:26:02 -070019git clone $REPO $DIR
Jake Whartone8586ef2012-11-07 11:30:43 -080020
21# Move working directory into temp folder
22cd $DIR
23
24# Checkout and track the gh-pages branch
25git checkout -t origin/gh-pages
26
27# Delete everything
Jake Whartonf351d672012-11-07 13:00:06 -080028rm -rf *
Jake Whartone8586ef2012-11-07 11:30:43 -080029
30# Copy website files from real repo
31cp -R ../website/* .
32
Jake Wharton05b55692013-05-07 10:26:02 -070033# Download the latest javadoc
34curl -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
35mkdir javadoc
36unzip javadoc.zip -d javadoc
37rm javadoc.zip
38
Jake Whartone8586ef2012-11-07 11:30:43 -080039# Stage all files in git and create a commit
40git add .
Jake Whartonf351d672012-11-07 13:00:06 -080041git add -u
Jake Wharton7f98b592012-11-07 13:50:17 -080042git commit -m "Website at $(date)"
Jake Whartone8586ef2012-11-07 11:30:43 -080043
44# Push the new files up to GitHub
45git push origin gh-pages
46
47# Delete our temp folder
48cd ..
49rm -rf $DIR