24
24
25
25
set -e # Exit with nonzero exit code if anything fails
26
26
27
+ # Determine if the current commit is release
28
+ TRAVIS_MASTER_BRANCH=" master"
29
+ TRAVIS_LATEST_RELEASE_WEBSITE_BRANCH=" latest-release-website"
30
+
27
31
# Config variables
28
32
REPO=` git config remote.origin.url`
29
33
SSH_REPO=${REPO/ https: \/\/ ${GH_URL} \/ / git@ ${GH_URL} : }
@@ -35,21 +39,67 @@ git clone --quiet --branch=gh-pages $REPO gh-pages || git checkout --orphan gh-p
35
39
echo " Before remove gh-pages"
36
40
ls -a gh-pages
37
41
38
- # Clean gh-pages existing contents
39
- rm -rf gh-pages/* || exit 0
42
+ if [ " $TRAVIS_BRANCH " == " $TRAVIS_LATEST_RELEASE_WEBSITE_BRANCH " ]; then
43
+ # ##
44
+ # ## Publish docs on commit in latest-release-website branch
45
+ # ##
40
46
41
- # Run the build again so rollup can generate the correct public path urls
42
- cd $TRAVIS_BUILD_DIR
43
- DEPLOY_PUBLIC_PATH=https://sap.github.io/ui5-webcomponents yarn build
47
+ echo " Before update release version on gh-pages"
44
48
45
- # Move master build folder to gh-pages folder
46
- cp -Rf $TRAVIS_BUILD_DIR /packages/playground/dist/* gh-pages
49
+ # Enable use of extended pattern matching operators(*, ?, @, !)
50
+ shopt -s extglob
51
+
52
+ # Remove all folders and files from gh-pages, but folder master
53
+ cd gh-pages
54
+ rm -v ! (" master" )|| exit 0
55
+ cd ..
56
+
57
+ # Run the build again so rollup can generate the correct public path urls
58
+ cd $TRAVIS_BUILD_DIR
59
+ DEPLOY_PUBLIC_PATH=https://sap.github.io/ui5-webcomponents/ yarn build
60
+
61
+ # Move master build folder to gh-pages folder
62
+ cp -Rf $TRAVIS_BUILD_DIR /packages/playground/dist/* gh-pages
63
+
64
+ # put the commit id as version
65
+ echo " $( git log -1 HEAD) " > gh-pages/version.txt
66
+
67
+ echo " After update release version on gh-pages"
68
+ ls -a gh-pages
69
+
70
+ # ##
71
+ # ## End of publish docs on commit in latest-release-website branch
72
+ # ##
73
+
74
+ elif [ " $TRAVIS_BRANCH " == " $TRAVIS_MASTER_BRANCH " ]; then
75
+ # ##
76
+ # ## Publish master on every commit in master branch
77
+ # ##
78
+
79
+ echo " Before update master version on gh-pages"
80
+
81
+ # Clean gh-pages existing contents
82
+ rm -rf gh-pages/master|| exit 0
83
+
84
+ # Run the build again so rollup can generate the correct public path urls
85
+ cd $TRAVIS_BUILD_DIR
86
+ DEPLOY_PUBLIC_PATH=https://sap.github.io/ui5-webcomponents/master yarn build
87
+
88
+ # Move master build folder to gh-pages folder
89
+ cp -Rf $TRAVIS_BUILD_DIR /packages/playground/dist/* gh-pages/master
90
+
91
+ # put the commit id as version
92
+ echo " $( git log -1 HEAD) " > gh-pages/version.txt
93
+
94
+ echo " After update master version on gh-pages"
95
+ ls -a gh-pages
96
+
97
+ # ##
98
+ # ## End of publish master on every commit in master branch
99
+ # ##
100
+ fi
47
101
48
- # put the commit id as version
49
- echo " $( git log -1 HEAD) " > gh-pages/version.txt
50
102
51
- echo " After update gh-pages"
52
- ls -a gh-pages
53
103
54
104
# Configure Git
55
105
cd gh-pages
0 commit comments