forked from square/wire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_website.sh
executable file
·53 lines (40 loc) · 1.3 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
#!/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: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/docs\/wire_compiler.md/wire_compiler/' 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
# 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