forked from square/wire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_website.sh
executable file
·62 lines (49 loc) · 1.63 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
#!/bin/bash
# The website is built using MkDocs with the Material theme.
# https://squidfunk.github.io/mkdocs-material/
# It requires Python to run.
# Install the packages with the following command:
# pip install mkdocs mkdocs-material
set -ex
REPO="[email protected]:square/wire.git"
DIR=temp-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
# Generate the API docs
./gradlew \
:wire-grpc-client:dokkaGfm \
:wire-moshi-adapter:dokkaGfm \
:wire-runtime:dokkaGfm \
:wire-compiler:dokkaGfm \
:wire-gson-support:dokkaGfm \
:wire-java-generator:dokkaGfm \
:wire-kotlin-generator:dokkaGfm \
:wire-reflector:dokkaGfm \
:wire-schema:dokkaGfm \
:wire-swift-generator:dokkaGfm
# Fix *.md links to point to where the docs live under Mkdocs.
# Linux
# sed -i 's/docs\/wire_compiler.md/wire_compiler/' README.md
# OSX
sed -i "" 's/docs\/wire_compiler.md/wire_compiler/' README.md
sed -i "" 's/docs\/wire_grpc.md/wire_grpc/' README.md
# Copy in special files that GitHub wants in the project root.
cat README.md | grep -v 'project website' > docs/index.md
cp CHANGELOG.md docs/changelog.md
cp CONTRIBUTING.md docs/contributing.md
cp RELEASING.md docs/releasing.md
# Build the site and push the new files up to GitHub
mkdocs gh-deploy
# Undo any file changes to be able to jump branches.
git checkout -- .
# Restore Javadocs from 2.x
git checkout gh-pages
git cherry-pick 0e1192aaa1d074c9703748fae100daef707218d4
git push --set-upstream origin gh-pages && git push
# Delete our temp folder
cd ..
rm -rf $DIR