Skip to content

Commit 476f8e2

Browse files
authoredJul 7, 2019
feat(docs): Add documentation for released version (#400)
1 parent a44cdc6 commit 476f8e2

File tree

1 file changed

+61
-11
lines changed

1 file changed

+61
-11
lines changed
 

‎deploy/deploy.sh

+61-11
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424

2525
set -e # Exit with nonzero exit code if anything fails
2626

27+
# Determine if the current commit is release
28+
TRAVIS_MASTER_BRANCH="master"
29+
TRAVIS_LATEST_RELEASE_WEBSITE_BRANCH="latest-release-website"
30+
2731
# Config variables
2832
REPO=`git config remote.origin.url`
2933
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
3539
echo "Before remove gh-pages"
3640
ls -a gh-pages
3741

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+
###
4046

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"
4448

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
47101

48-
# put the commit id as version
49-
echo "$(git log -1 HEAD)" > gh-pages/version.txt
50102

51-
echo "After update gh-pages"
52-
ls -a gh-pages
53103

54104
# Configure Git
55105
cd gh-pages

0 commit comments

Comments
 (0)
Please sign in to comment.