blob: 1fde1bd5760cd6bf664bcada25292ac10fb1732f [file] [log] [blame]
Paul Duffin5d3207a2015-11-23 13:25:38 +00001#!/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
9REPO="git@github.com:square/dagger.git"
10GROUP_ID="com.squareup.dagger"
11ARTIFACT_ID="dagger"
12
13DIR=temp-dagger-clone
14
15# Delete any existing temporary website clone
16rm -rf $DIR
17
18# Clone the current repo into temp folder
19git clone $REPO $DIR
20
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
28rm -rf *
29
30# Copy website files from real repo
31cp -R ../website/* .
32
33# 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
39# Stage all files in git and create a commit
40git add .
41git add -u
42git commit -m "Website at $(date)"
43
44# Push the new files up to GitHub
45git push origin gh-pages
46
47# Delete our temp folder
48cd ..
49rm -rf $DIR