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

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


The following commit(s) were added to refs/heads/java-chassis-1.x by this push:
     new 5d52dab  write scripts for 1.x (#119)
5d52dab is described below

commit 5d52dabec335c92139a84339b715af060a739f59
Author: bao liu <[email protected]>
AuthorDate: Mon Feb 10 15:31:07 2020 +0800

    write scripts for 1.x (#119)
---
 .travis.yml       | 20 +++++++-------------
 scripts/travis.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 13 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 96cf703..b3ba8d8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,16 +1,10 @@
-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 clone --depth=10 --branch=master https://$PUSH_TARGET_URL 
servicecomb-java-chassis-doc
-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
+install:
+  - chmod +x scripts/travis.sh
+script: 
+  - scripts/travis.sh script
+after_success: 
+  - scripts/travis.sh after_success
 branches:
  only:
   - master
+  - java-chassis-1.x
diff --git a/scripts/travis.sh b/scripts/travis.sh
new file mode 100644
index 0000000..d23e554
--- /dev/null
+++ b/scripts/travis.sh
@@ -0,0 +1,55 @@
+#!/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" == "script" ]; 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
+    mkdir servicecomb-java-chassis-doc/temp
+    cp -r servicecomb-java-chassis-doc/docs/java-chassis/1.x 
servicecomb-java-chassis-doc/temp
+    rm -r servicecomb-java-chassis-doc/docs/*
+    cp -r docs/ servicecomb-java-chassis-doc/
+    cp -r servicecomb-java-chassis-doc/temp/1.x docs/ 
servicecomb-java-chassis-doc/java-chassis
+    rm -r servicecomb-java-chassis-doc/temp
+  elif [ "$TRAVIS_BRANCH" == "java-chassis-1.x" ]; then
+    rm -r servicecomb-java-chassis-doc/docs/java-chassis/1.x/*
+    cp -r docs/java-chassis/* 
servicecomb-java-chassis-doc/docs/java-chassis/1.x
+  else
+    exit 1
+  fi
+elif [ "$1" == "after_success" ]; then
+  if [ -z $DEPLOY_TOKEN ]; then
+    echo "PR release if ignored"
+  else
+    cd servicecomb-java-chassis-doc
+    git add docs
+    git commit -m "Publish gitbook docs"
+    git push https://$DEPLOY_TOKEN@$PUSH_TARGET_URL master
+  fi
+else 
+  exit 1
+fi
+

Reply via email to