Narayan Kamath | 166772b | 2013-11-04 16:04:55 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | REPO="git@github.com:square/okhttp.git" |
Narayan Kamath | 166772b | 2013-11-04 16:04:55 +0000 | [diff] [blame] | 6 | DIR=temp-clone |
| 7 | |
| 8 | # Delete any existing temporary website clone |
| 9 | rm -rf $DIR |
| 10 | |
| 11 | # Clone the current repo into temp folder |
| 12 | git clone $REPO $DIR |
| 13 | |
| 14 | # Move working directory into temp folder |
| 15 | cd $DIR |
| 16 | |
| 17 | # Checkout and track the gh-pages branch |
| 18 | git checkout -t origin/gh-pages |
| 19 | |
Tobias Thierer | 6c251e2 | 2016-06-24 19:04:17 +0100 | [diff] [blame] | 20 | # Delete everything that isn't versioned (1.x, 2.x) |
| 21 | ls | grep -E -v '^\d+\.x$' | xargs rm -rf |
Narayan Kamath | 166772b | 2013-11-04 16:04:55 +0000 | [diff] [blame] | 22 | |
| 23 | # Copy website files from real repo |
| 24 | cp -R ../website/* . |
| 25 | |
Narayan Kamath | 166772b | 2013-11-04 16:04:55 +0000 | [diff] [blame] | 26 | # Stage all files in git and create a commit |
| 27 | git add . |
| 28 | git add -u |
| 29 | git commit -m "Website at $(date)" |
| 30 | |
| 31 | # Push the new files up to GitHub |
| 32 | git push origin gh-pages |
| 33 | |
| 34 | # Delete our temp folder |
| 35 | cd .. |
| 36 | rm -rf $DIR |