|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (c) 2018 PaddlePaddle Authors. 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 | + |
| 17 | +# This script is used to deploy the English specific documents. |
| 18 | +# EX: Book, Mobile and Models. They are not yet consolidated into one Doc tree. |
| 19 | + |
| 20 | +exit_code=0 |
| 21 | + |
| 22 | +if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit $exit_code; fi; |
| 23 | + |
| 24 | +# Deploy to the the content server if its a "develop" or "release/version" branch |
| 25 | +# The "develop_doc" branch is reserved to test full deploy process without impacting the real content. |
| 26 | +if [ "$TRAVIS_BRANCH" == "develop_doc" ]; then |
| 27 | + PPO_SCRIPT_BRANCH=develop |
| 28 | +elif [[ "$TRAVIS_BRANCH" == "develop" || "$TRAVIS_BRANCH" =~ ^v|release/[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?(-\S*)?$ ]]; then |
| 29 | + PPO_SCRIPT_BRANCH=master |
| 30 | +else |
| 31 | + # Early exit, this branch doesn't require documentation build |
| 32 | + echo "This branch doesn't require documentation build" |
| 33 | + exit $exit_code; |
| 34 | +fi |
| 35 | + |
| 36 | +export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/$PPO_SCRIPT_BRANCH/scripts/deploy/deploy_docs.sh |
| 37 | + |
| 38 | +echo "Deploy book under docker environment" |
| 39 | +docker run -it \ |
| 40 | + -e CONTENT_DEC_PASSWD=$CONTENT_DEC_PASSWD \ |
| 41 | + -e TRAVIS_BRANCH=$TRAVIS_BRANCH \ |
| 42 | + -e DEPLOY_DOCS_SH=$DEPLOY_DOCS_SH \ |
| 43 | + -e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST \ |
| 44 | + -e PPO_SCRIPT_BRANCH=$PPO_SCRIPT_BRANCH \ |
| 45 | + -e PADDLE_ROOT=/FluidDoc/external/Paddle \ |
| 46 | + -e PYTHONPATH=/FluidDoc/external/Paddle/build/python \ |
| 47 | + -v "$PWD:/FluidDoc" \ |
| 48 | + -w /FluidDoc \ |
| 49 | + paddlepaddle/paddle:latest-dev \ |
| 50 | + /bin/bash -c 'curl $DEPLOY_DOCS_SH | bash -s $CONTENT_DEC_PASSWD $TRAVIS_BRANCH /FluidDoc/external /FluidDoc/external $PPO_SCRIPT_BRANCH' || exit_code=$(( exit_code | $? )) |
| 51 | + |
| 52 | +exit $exit_code |
0 commit comments