xref: /aosp_15_r20/external/okhttp/deploy_website.sh (revision ab625e417e7950f52094c019474d2a9e9f14a68c)
1*ab625e41SAndroid Build Coastguard Worker#!/bin/bash
2*ab625e41SAndroid Build Coastguard Worker
3*ab625e41SAndroid Build Coastguard Workerset -ex
4*ab625e41SAndroid Build Coastguard Worker
5*ab625e41SAndroid Build Coastguard WorkerREPO="[email protected]:square/okhttp.git"
6*ab625e41SAndroid Build Coastguard WorkerDIR=temp-clone
7*ab625e41SAndroid Build Coastguard Worker
8*ab625e41SAndroid Build Coastguard Worker# Delete any existing temporary website clone
9*ab625e41SAndroid Build Coastguard Workerrm -rf $DIR
10*ab625e41SAndroid Build Coastguard Worker
11*ab625e41SAndroid Build Coastguard Worker# Clone the current repo into temp folder
12*ab625e41SAndroid Build Coastguard Workergit clone $REPO $DIR
13*ab625e41SAndroid Build Coastguard Worker
14*ab625e41SAndroid Build Coastguard Worker# Move working directory into temp folder
15*ab625e41SAndroid Build Coastguard Workercd $DIR
16*ab625e41SAndroid Build Coastguard Worker
17*ab625e41SAndroid Build Coastguard Worker# Checkout and track the gh-pages branch
18*ab625e41SAndroid Build Coastguard Workergit checkout -t origin/gh-pages
19*ab625e41SAndroid Build Coastguard Worker
20*ab625e41SAndroid Build Coastguard Worker# Delete everything that isn't versioned (1.x, 2.x)
21*ab625e41SAndroid Build Coastguard Workerls | grep -E -v '^\d+\.x$' | xargs rm -rf
22*ab625e41SAndroid Build Coastguard Worker
23*ab625e41SAndroid Build Coastguard Worker# Copy website files from real repo
24*ab625e41SAndroid Build Coastguard Workercp -R ../website/* .
25*ab625e41SAndroid Build Coastguard Worker
26*ab625e41SAndroid Build Coastguard Worker# Stage all files in git and create a commit
27*ab625e41SAndroid Build Coastguard Workergit add .
28*ab625e41SAndroid Build Coastguard Workergit add -u
29*ab625e41SAndroid Build Coastguard Workergit commit -m "Website at $(date)"
30*ab625e41SAndroid Build Coastguard Worker
31*ab625e41SAndroid Build Coastguard Worker# Push the new files up to GitHub
32*ab625e41SAndroid Build Coastguard Workergit push origin gh-pages
33*ab625e41SAndroid Build Coastguard Worker
34*ab625e41SAndroid Build Coastguard Worker# Delete our temp folder
35*ab625e41SAndroid Build Coastguard Workercd ..
36*ab625e41SAndroid Build Coastguard Workerrm -rf $DIR
37