-
Notifications
You must be signed in to change notification settings - Fork 60
/
update_javadoc.sh
executable file
·47 lines (37 loc) · 903 Bytes
/
update_javadoc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -ex
# Lib constants
REPO="git@github.com:hamidness/restring.git"
GROUP_ID="com.ice.restring"
ARTIFACT_ID="restring"
VERSION="1.0.0"
# Javadoc constants
FILE_PATH="${GROUP_ID//./%2F}%2F${ARTIFACT_ID}%2F${VERSION}%2F${ARTIFACT_ID}-${VERSION}-javadoc.jar"
URL="https://bintray.com/hamidfri/maven/download_file?file_path=$FILE_PATH"
# Script constants
TEMP_DIR=temp-clone
DOCS_DIR=docs
BRANCH_NAME=update_javadoc
# Delete temps
rm -rf $TEMP_DIR
# Clone the repo and create a new branch
git clone $REPO $TEMP_DIR
cd $TEMP_DIR
git checkout -b $BRANCH_NAME
# Delete docs
rm -rf $DOCS_DIR
# Download the latest javadoc
mkdir $DOCS_DIR
cd $DOCS_DIR
curl -L "$URL" > javadoc.zip
unzip javadoc.zip
rm javadoc.zip
cd ..
# Commit and push new javadoc
git add .
git add -u
git commit -m "Update javadoc at $(date)"
git push --set-upstream origin $BRANCH_NAME
# Cleanup
cd ..
rm -rf $TEMP_DIR