...
1#!/usr/bin/env bash
2
3# Copyright 2018-2019 Datawire. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License
16
17set -o errexit
18
19if [ -z "$WEBSITE_BRANCH" ]; then
20 WEBSITE_BRANCH="master"
21fi
22
23if [ -n "$1" ]; then
24 WEBSITE_DIR="$1"
25elif [ -z "$WEBSITE_DIR" ]; then
26 WEBSITE_DIR="/tmp/getambassador.io-${WEBSITE_BRANCH}"
27fi
28
29set -o nounset
30set -o xtrace
31
32source_dir=$(pwd)
33
34if [ \( $(basename $source_dir) != "ambassador" \) -a \( -d "$source_dir/ambassador/docs" \) ]; then
35 source_dir="$source_dir/ambassador"
36fi
37
38cd "$WEBSITE_DIR"
39
40# In the Real World, we use git submodule to update all the docs, but for our purposes here, we're
41# not "really" building all the docs -- we just want a single preview.
42rsync -av "${source_dir}/docs/" submodules/latest/docs
43
44# Since we only want the one preview, toss out links to other versions from the header...
45sed -e '/to="\/docs\/[0-9]/d' < src/components/Header/Header.js > H2.js && mv H2.js src/components/Header/Header.js
46
47# ...and in docs-structure.
48# rm -f docs-structure/docs/[0-9]*
View as plain text