Explorar o código

Make doc push more flexible and valid for all branches

Stefan Profanter %!s(int64=7) %!d(string=hai) anos
pai
achega
501beb0514

+ 3 - 1
tools/travis/travis_linux_after_success.sh

@@ -6,7 +6,9 @@ if [ -z ${DOCKER+x} ]; then
 
 	if [ "$ANALYZE" = "false" ] && [ "$CC" = "gcc" ] && [ "${TRAVIS_REPO_SLUG}" = "open62541/open62541" ]; then
 		echo "=== Executing after_success scripts ==="
-		if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "0.3" ]; then
+		# List branches where the doc should be pushed to the webpage
+		if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && (
+		    [ "${TRAVIS_BRANCH}" = "master" ] || [ "${TRAVIS_BRANCH}" = "0.3" ]); then
 			sh ./tools/travis/travis_push_doc.sh
 			sh ./tools/travis/travis_push_coverity.sh
 		fi

+ 1 - 1
tools/travis/travis_push_coverity.sh

@@ -4,7 +4,7 @@ set -ev
 # This script is run by travis-ci and pushes the first commit
 # of the day to the coverity scan service
 
-echo "=== Pushing master to coverity_scan branch ==="
+echo "=== Pushing ${TRAVIS_BRANCH} to coverity_scan branch ==="
 
 COMMITS=`git log --oneline --since=today.midnight | wc -l`
 if [ "$COMMITS" -le 1 ]; then

+ 14 - 3
tools/travis/travis_push_doc.sh

@@ -1,6 +1,9 @@
 #!/bin/bash
 set -ev
 
+# This script will only be executed on branches which are either master or a release
+# See travis_linux_after_success.sh
+
 # The encrypted key is not available in pull requests from forks
 if [ -z "$GITAUTH" ]; then
     exit 0
@@ -9,9 +12,17 @@ fi
 git clone --depth=5 -b gh-pages https://$GITAUTH@github.com/open62541/open62541-www
 cd open62541-www
 
-rm -r -f ./doc/0.3 || true # ignore result
-mkdir ./doc/0.3 || true # ignore result
-cp -r ../../doc/* ./doc/0.3/
+target_dir="${TRAVIS_BRANCH}"
+
+if [ "${TRAVIS_BRANCH}" = "master" ]; then
+    target_dir="current"
+fi
+
+echo "=== Pushing doc for ${target_dir} ==="
+
+rm -r -f ./doc/${target_dir} || true # ignore result
+mkdir ./doc/${target_dir} || true # ignore result
+cp -r ../../doc/* ./doc/${target_dir}/
 cp -r ../../doc_latex/open62541.pdf ./doc/open62541-current.pdf
 git add -A ./doc
 git config --global user.email "open62541-travis-ci@users.noreply.github.com"