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