Skip to content

Commit 137fc7e

Browse files
committed
travis: separate master and preview urls
1 parent 0c627b2 commit 137fc7e

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# To check the status of the CI job:
2-
# https://travis-ci.org/github/gnu-mcu-eclipse/web-jekyll
2+
# https://travis-ci.com/github/eclipse-embed-cdt/web-jekyll
33

44
# Travis CI configuration file to validate and deploy
55
# the Eclipse Embedded CDT Jekyll site.
@@ -30,7 +30,8 @@ git:
3030

3131
env:
3232
global:
33-
- GITHUB_DEST_REPO="eclipse-embed-cdt/web-preview"
33+
- GITHUB_DEST_REPO="eclipse-embed-cdt/eclipse-embed-cdt.github.io"
34+
- GITHUB_PREVIEW_REPO="eclipse-embed-cdt/web-preview"
3435
- GIT_COMMIT_USER_EMAIL="[email protected]"
3536
- GIT_COMMIT_USER_NAME="Travis CI"
3637
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true

scripts/travis.linux.sh

+13-9
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ function do_before_script() {
7575
run_verbose git config --global user.name "${GIT_COMMIT_USER_NAME}"
7676

7777
# Clone the destination repo.
78-
run_verbose git clone --branch=master https://github.com/${GITHUB_DEST_REPO}.git "${dest_repo}"
78+
if [ "${TRAVIS_BRANCH}" == "master" ]
79+
then
80+
run_verbose git clone --branch=master https://github.com/${GITHUB_DEST_REPO}.git "${dest_repo}"
81+
else
82+
run_verbose git clone --branch=master https://github.com/${GITHUB_PREVIEW_REPO}.git "${dest_repo}"
83+
fi
7984

8085
return 0
8186
}
@@ -113,19 +118,13 @@ function do_script() {
113118
fi
114119

115120
# ---------------------------------------------------------------------------
116-
# The deployment code is present here not in after_success,
121+
# The deployment code is present here (and not in after_success),
117122
# to break the build if not successful.
118123

119124
cd "${dest_repo}"
120125

121126
touch ".nojekyll"
122127

123-
if [ "${TRAVIS_BRANCH}" != "master" ]
124-
then
125-
echo "Not on master branch, skip deploy."
126-
return 0;
127-
fi
128-
129128
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]
130129
then
131130
echo "A pull request, skip deploy."
@@ -150,7 +149,12 @@ function do_script() {
150149
echo "Deploy to GitHub pages..."
151150

152151
# Must be quiet and have no output, to not reveal the key.
153-
git push --force --quiet "https://${GITHUB_TOKEN}@github.com/${GITHUB_DEST_REPO}" master > /dev/null 2>&1
152+
if [ "${TRAVIS_BRANCH}" == "master" ]
153+
then
154+
git push --force --quiet "https://${GITHUB_TOKEN}@github.com/${GITHUB_DEST_REPO}" master > /dev/null 2>&1
155+
else
156+
git push --force --quiet "https://${GITHUB_TOKEN}@github.com/${GITHUB_PREVIEW_REPO}" master > /dev/null 2>&1
157+
fi
154158

155159
return 0
156160
}

0 commit comments

Comments
 (0)