forked from playframework/playframework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployApiDocs
executable file
·77 lines (64 loc) · 1.41 KB
/
deployApiDocs
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
68
69
70
71
72
73
74
75
#! /bin/bash
# Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
# Usage: deployApiDocs <branch> [ <tag> ]
#
# If you have checked out a tag, then you must supply the branch to deploy the docs to.
#
# If you want the repo tagged, then supply a tag argument
set -e
BRANCH=$1
TAG=$2
if [ -z "$BRANCH" ]
then
echo You must specify a branch
fi
PLAYVERSION=""
if [ -n "$TAG" ]
then
echo Will tag version $TAG
PLAYVERSION=-Dplay.version=$TAG
fi
# build the docs
./build $PLAYVERSION -Dgit.branch=$BRANCH api-docs
mkdir -p target
cd target
# clone the git repo if it's not already there
if [ -d play-generated-docs ]
then
cd play-generated-docs
git fetch
else
git clone [email protected]:playframework/play-generated-docs.git
cd play-generated-docs
fi
# Create the branch if it doesn't already exist
if git branch -a | grep -q $BRANCH
then
git checkout $BRANCH
git merge origin/$BRANCH
else
git checkout -b $BRANCH
fi
rm -r *
mv ../../src/play-docs/target/apidocs api
if ! git diff -w --quiet
then
git add --all
# Commit changes
echo "Docs have changed, committing and pushing..."
if [ -z "$TAG" ]
then
git commit -m "Api docs changed"
else
git commit -m "Update for $TAG"
fi
git push origin $BRANCH
else
echo "No changes in docs"
fi
if [ -n "$TAG" ]
then
echo "Tagging docs..."
git tag -a -m $TAG $TAG
git push --tags
fi