-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy_website.sh
executable file
·67 lines (48 loc) · 1.93 KB
/
deploy_website.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
#
# Deploys the current Asset File Generator website to the gh-pages branch of the GitHub
# repository. To test the site locally before deploying run `jekyll --server`
# in the website/ directory.
set -ex
REPO="[email protected]:guicamest/dexlazyloader.git"
USER_ID="guicamest"
GROUP_ID="io.github.guicamest.dexlazyloader"
ARTIFACT_ID="library"
#LATEST_VERSION=`curl "https://api.bintray.com/packages/guicamest/maven/dexlazyloader" | jq '.latest_version'`
#LATEST_VERSION="${LATEST_VERSION//\"/}"
LATEST_VERSION=0.1.0
#LATEST_PLUGIN_VERSION=`curl "https://api.bintray.com/packages/guicamest/maven/dexlazyloader" | jq '.latest_version'`
#LATEST_PLUGIN_VERSION="${LATEST_PLUGIN_VERSION//\"/}"
LATEST_PLUGIN_VERSION=0.1.0
GROUP_PATH="${GROUP_ID//\./\/}"
sed -e "s/%LIBRARY_VERSION%/'$LATEST_VERSION'/g" website/tpl/jquery-maven-artifact.min.js > website/static/jquery-maven-artifact.min.js
sed -i -e "s/%PLUGIN_VERSION%/'$LATEST_PLUGIN_VERSION'/g" website/static/jquery-maven-artifact.min.js
curl -f -L -I "https://dl.bintray.com/$USER_ID/maven/$GROUP_PATH/$ARTIFACT_ID/$LATEST_VERSION/$ARTIFACT_ID-$LATEST_VERSION-javadoc.jar"
DIR=temp-dexlazyloader-clone
# Delete any existing temporary website clone
rm -rf $DIR
# Clone the current repo into temp folder
git clone $REPO $DIR
# Move working directory into temp folder
cd $DIR
# Checkout and track the gh-pages branch
git checkout -t origin/gh-pages
# Delete everything
rm -rf *
# Copy website files from real repo
cp -R ../website/* .
# Download the latest javadoc
curl -L "https://dl.bintray.com/$USER_ID/maven/$GROUP_PATH/$ARTIFACT_ID/$LATEST_VERSION/$ARTIFACT_ID-$LATEST_VERSION-javadoc.jar" > javadoc.zip
#unzip javadoc.zip -d javadoc
mkdir javadoc
winrar x javadoc.zip -d javadoc
rm javadoc.zip
# Stage all files in git and create a commit
git add .
git add -u
git commit -m "Website at $(date)"
# Push the new files up to GitHub
git push origin gh-pages
# Delete our temp folder
cd ..
rm -rf $DIR