xref: /aosp_15_r20/external/moshi/deploy_javadoc.sh (revision 238ab3e782f339ab327592a602fa7df0a3f729ad)
1*238ab3e7SAndroid Build Coastguard Worker#!/bin/bash
2*238ab3e7SAndroid Build Coastguard Worker
3*238ab3e7SAndroid Build Coastguard Workerset -ex
4*238ab3e7SAndroid Build Coastguard Worker
5*238ab3e7SAndroid Build Coastguard WorkerREPO="[email protected]:square/moshi.git"
6*238ab3e7SAndroid Build Coastguard WorkerGROUP_ID="com.squareup.moshi"
7*238ab3e7SAndroid Build Coastguard WorkerARTIFACT_ID="moshi"
8*238ab3e7SAndroid Build Coastguard Worker
9*238ab3e7SAndroid Build Coastguard WorkerDIR=temp-clone
10*238ab3e7SAndroid Build Coastguard Worker
11*238ab3e7SAndroid Build Coastguard Worker# Delete any existing temporary website clone
12*238ab3e7SAndroid Build Coastguard Workerrm -rf $DIR
13*238ab3e7SAndroid Build Coastguard Worker
14*238ab3e7SAndroid Build Coastguard Worker# Clone the current repo into temp folder
15*238ab3e7SAndroid Build Coastguard Workergit clone $REPO $DIR
16*238ab3e7SAndroid Build Coastguard Worker
17*238ab3e7SAndroid Build Coastguard Worker# Move working directory into temp folder
18*238ab3e7SAndroid Build Coastguard Workercd $DIR
19*238ab3e7SAndroid Build Coastguard Worker
20*238ab3e7SAndroid Build Coastguard Worker# Checkout and track the gh-pages branch
21*238ab3e7SAndroid Build Coastguard Workergit checkout -t origin/gh-pages
22*238ab3e7SAndroid Build Coastguard Worker
23*238ab3e7SAndroid Build Coastguard Worker# Delete everything
24*238ab3e7SAndroid Build Coastguard Workerrm -rf *
25*238ab3e7SAndroid Build Coastguard Worker
26*238ab3e7SAndroid Build Coastguard Worker# Download the latest javadoc
27*238ab3e7SAndroid Build Coastguard Workercurl -L "https://search.maven.org/remote_content?g=$GROUP_ID&a=$ARTIFACT_ID&v=LATEST&c=javadoc" > javadoc.zip
28*238ab3e7SAndroid Build Coastguard Workerunzip javadoc.zip
29*238ab3e7SAndroid Build Coastguard Workerrm javadoc.zip
30*238ab3e7SAndroid Build Coastguard Worker
31*238ab3e7SAndroid Build Coastguard Worker# Stage all files in git and create a commit
32*238ab3e7SAndroid Build Coastguard Workergit add .
33*238ab3e7SAndroid Build Coastguard Workergit add -u
34*238ab3e7SAndroid Build Coastguard Workergit commit -m "Website at $(date)"
35*238ab3e7SAndroid Build Coastguard Worker
36*238ab3e7SAndroid Build Coastguard Worker# Push the new files up to GitHub
37*238ab3e7SAndroid Build Coastguard Workergit push origin gh-pages
38*238ab3e7SAndroid Build Coastguard Worker
39*238ab3e7SAndroid Build Coastguard Worker# Delete our temp folder
40*238ab3e7SAndroid Build Coastguard Workercd ..
41*238ab3e7SAndroid Build Coastguard Workerrm -rf $DIR
42