You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2020/02/10 04:01:34 UTC

[servicecomb-docs] branch master updated: update travis to build many branches (#117)

This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-docs.git


The following commit(s) were added to refs/heads/master by this push:
     new 098a60b  update travis to build many branches (#117)
098a60b is described below

commit 098a60be0692c6d01b23ac3b5390baab7e84784b
Author: bao liu <bi...@qq.com>
AuthorDate: Mon Feb 10 12:01:26 2020 +0800

    update travis to build many branches (#117)
---
 .travis.yml       | 20 +++++---------------
 scripts/travis.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index d4ba55c..90d913c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,9 @@
-script:
-  - npm install gitbook-cli -g
-  - gitbook build java-chassis-reference docs/java-chassis
-  - gitbook build saga-reference docs/saga
-  - gitbook build service-center-reference docs/service-center
-  - git fetch
-  - git checkout -f -B java-chassis-1.x remotes/origin/java-chassis-1.x
-  - gitbook build java-chassis-reference docs/java-chassis/1.x
-  - git clone --depth=10 --branch=master https://$PUSH_TARGET_URL servicecomb-java-chassis-doc
+before_install:
+  - chmod +x scripts/travis.sh
+script: scripts/travis.sh install
 after_success:
-  - cp -r docs/ servicecomb-java-chassis-doc/
-  - cd servicecomb-java-chassis-doc
-  - git checkout -b master
-  - git add docs
-  - git commit -m "Publish gitbook docs"
-  - git push https://$DEPLOY_TOKEN@$PUSH_TARGET_URL master
+  script: scripts/travis.sh deploy
 branches:
  only:
   - master
+  - java-chassis-1.x
diff --git a/scripts/travis.sh b/scripts/travis.sh
new file mode 100644
index 0000000..58b2e67
--- /dev/null
+++ b/scripts/travis.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+#bin/sh
+
+echo "start building servicecomb-docs."
+echo "env TRAVIS_BRANCH=$TRAVIS_BRANCH"
+echo "env PARAM1=$1"
+
+if [ "$1" == "install" ]; then
+  npm install gitbook-cli -g
+  gitbook build java-chassis-reference docs/java-chassis
+  gitbook build saga-reference docs/saga
+  gitbook build service-center-reference docs/service-center
+  git clone --depth=10 --branch=master https://$PUSH_TARGET_URL servicecomb-java-chassis-doc
+  if [ "$TRAVIS_BRANCH" == "master" ]; then
+    cp -r docs/ servicecomb-java-chassis-doc/
+  elif [ "$TRAVIS_BRANCH" == "java-chassis-1.x" ]; then
+    cp -r docs/java-chassis servicecomb-java-chassis-doc/java-chassis/1.x
+  else
+    exit 1
+  fi
+elif [ "$1" == "deploy" ]; then
+  cd servicecomb-java-chassis-doc
+  git checkout -b master
+  git add docs
+  git commit -m "Publish gitbook docs"
+  git push https://$DEPLOY_TOKEN@$PUSH_TARGET_URL master
+else 
+  exit 1
+fi
+