c20d6c30bd3248438e8a61f62611dd7475186379
[platform/upstream/grpc.git] / src / csharp / doc / generate_reference_docs.sh
1 #!/bin/sh
2 # Copyright 2018 The gRPC Authors
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # Generates C# API docs using docfx inside docker.
17 set -ex
18 cd $(dirname $0)
19
20 # cleanup temporary files
21 rm -rf html obj grpc-gh-pages
22
23 # generate into src/csharp/doc/html directory
24 cd ..
25 docker run --rm -v "$(pwd)":/work -w /work/doc --user "$(id -u):$(id -g)" -it tsgkadot/docker-docfx:latest docfx
26 cd doc
27
28 # prepare a clone of "gh-pages" branch where the generated docs are stored
29 GITHUB_USER="${USER}"
30 git clone -b gh-pages -o upstream git@github.com:grpc/grpc.git grpc-gh-pages
31 cd grpc-gh-pages
32 git remote add origin "git@github.com:${GITHUB_USER}/grpc.git"
33
34 # replace old generated docs by the ones we just generated
35 rm -r csharp
36 cp -r ../html csharp
37
38 echo "Done. Go to src/csharp/doc/grpc-gh-pages git repository and create a pull request to update the generated docs."