• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3set -ex
4
5REPO="git@github.com:square/okhttp.git"
6GROUP_ID="com.squareup.okhttp"
7ARTIFACT_ID="okhttp"
8
9DIR=temp-clone
10
11# Delete any existing temporary website clone
12rm -rf $DIR
13
14# Clone the current repo into temp folder
15git clone $REPO $DIR
16
17# Move working directory into temp folder
18cd $DIR
19
20# Checkout and track the gh-pages branch
21git checkout -t origin/gh-pages
22
23# Delete everything
24rm -rf *
25
26# Copy website files from real repo
27cp -R ../website/* .
28
29# Download the latest javadoc to directories like 'javadoc' or 'javadoc-urlconnection'.
30for DOCUMENTED_ARTIFACT in okhttp okhttp-urlconnection okhttp-apache
31do
32  curl -L "https://search.maven.org/remote_content?g=$GROUP_ID&a=$DOCUMENTED_ARTIFACT&v=LATEST&c=javadoc" > javadoc.zip
33  JAVADOC_DIR="javadoc${DOCUMENTED_ARTIFACT//okhttp/}"
34  mkdir $JAVADOC_DIR
35  unzip javadoc.zip -d $JAVADOC_DIR
36  rm javadoc.zip
37done
38
39# Download the 1.6.0 javadoc to '1.x/javadoc'.
40curl -L "https://search.maven.org/remote_content?g=$GROUP_ID&a=$ARTIFACT_ID&v=1.6.0&c=javadoc" > javadoc.zip
41mkdir -p 1.x/javadoc
42unzip javadoc.zip -d 1.x/javadoc
43rm javadoc.zip
44
45# Stage all files in git and create a commit
46git add .
47git add -u
48git commit -m "Website at $(date)"
49
50# Push the new files up to GitHub
51git push origin gh-pages
52
53# Delete our temp folder
54cd ..
55rm -rf $DIR
56