druid/website/script/build-to-docs

59 lines
1.7 KiB
Plaintext
Raw Normal View History

#!/bin/bash -eu
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2019-09-24 21:19:06 -04:00
if [ "$#" -ne 2 ] && [ "$#" -ne 3 ]; then
echo "Illegal number of parameters, should one or two: the version, or the version and website-src directory";
exit 1;
fi
2019-09-24 21:19:06 -04:00
URL_VERSION=$1
DRUID_VERSION=$2
WEBSRC="../../incubator-druid-website-src"
2019-09-24 21:19:06 -04:00
if [ "$#" -gt 2 ]; then
WEBSRC=$3
fi
2019-09-24 21:19:06 -04:00
echo "Building to docs for '$URL_VERSION' to $WEBSRC ..."
npm run compile-scss
npm run build | tee ./build-log.txt
if grep -q "unresolved links in file" ./build-log.txt; then
echo "There are unresolved links, please fix";
rm build-log.txt;
#exit 1
else
rm build-log.txt
fi
2019-09-24 21:19:06 -04:00
node script/fix-path.js $URL_VERSION $DRUID_VERSION
echo "Cleaning..."
2019-09-24 21:19:06 -04:00
rm -rf $WEBSRC/docs/$URL_VERSION/
mkdir -p $WEBSRC/docs/$URL_VERSION/
2019-09-24 21:19:06 -04:00
cp -r ./build/ApacheDruid/docs/* $WEBSRC/docs/$URL_VERSION/
mkdir -p $WEBSRC/css
cp ./build/ApacheDruid/css/* $WEBSRC/css
mkdir -p $WEBSRC/js
cp ./build/ApacheDruid/js/* $WEBSRC/js