forked from square/wire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_website.sh
executable file
·57 lines (44 loc) · 1.51 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
#!/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 -p wire-library \
:wire-grpc-client:dokka \
:wire-moshi-adapter:dokka \
:wire-runtime:dokka
# 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/wire-library\/docs\/wire_compiler.md/wire_compiler/' README.md
sed -i "" 's/wire-library\/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' > wire-library/docs/index.md
cp CHANGELOG.md wire-library/docs/changelog.md
cp CONTRIBUTING.md wire-library/docs/contributing.md
cp RELEASING.md wire-library/docs/releasing.md
# Build the site and push the new files up to GitHub
cd wire-library
mkdocs gh-deploy
cd ..
# 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