Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit c754012

Browse files
Fix bug in docs build and publishing scripts (#4316)
Signed-off-by: Mark S. Lewis <[email protected]>
1 parent 8c65ea3 commit c754012

File tree

2 files changed

+30
-39
lines changed

2 files changed

+30
-39
lines changed

.travis/deploy.sh

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -84,35 +84,16 @@ git ls-remote
8484
# Log in to Docker Hub.
8585
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
8686

87-
# Determine the details of the suffixes for playground and NPM/docker tags
88-
if [[ "${BUILD_RELEASE}" == "unstable" ]]; then
89-
87+
if [ "${BUILD_RELEASE}" = 'unstable' ]; then
9088
# Set the prerelease version.
9189
npm run pkgstamp
92-
93-
if [[ "${BUILD_FOCUS}" == "latest" ]]; then
94-
PLAYGROUND_SUFFIX="-unstable"
95-
WEB_CFG="{\"webonly\":true}"
96-
TAG="unstable"
97-
elif [[ "${BUILD_FOCUS}" == "next" ]]; then
98-
PLAYGROUND_SUFFIX="-next-unstable"
99-
WEB_CFG="{\"webonly\":true}"
100-
TAG="next-unstable"
101-
else
102-
_exit "Unknown build focus" 1
103-
fi
104-
elif [[ "${BUILD_RELEASE}" == "stable" ]]; then
105-
if [[ "${BUILD_FOCUS}" == "latest" ]]; then
106-
PLAYGROUND_SUFFIX=""
107-
WEB_CFG="{\"webonly\":true}"
108-
TAG="latest"
109-
elif [[ "${BUILD_FOCUS}" == "next" ]]; then
110-
PLAYGROUND_SUFFIX="-next"
111-
WEB_CFG="{\"webonly\":true}"
112-
TAG="next"
113-
else
114-
_exit "Unknown build focus" 1
115-
fi
90+
fi
91+
92+
# Which (if any) tag to use for npm and docker publish
93+
if [ "${BUILD_FOCUS}" = 'latest' ]; then
94+
[ "${BUILD_RELEASE}" = 'stable' ] && TAG='latest' || TAG='unstable'
95+
else
96+
TAG=''
11697
fi
11798

11899
# Hold onto the version number
@@ -132,9 +113,13 @@ done
132113

133114
# Only enter here if ignore array is not same length as the publish array
134115
if [ "${#ALL_NPM_MODULES[@]}" -ne "${#IGNORE_NPM_MODULES[@]}" ]; then
135-
# Publish with tag
136-
echo "Pushing with tag ${TAG}"
137-
lerna exec --ignore '@('${IGNORE}')' -- npm publish --tag="${TAG}" 2>&1
116+
if [ -z "${TAG}" ]; then
117+
echo 'Publishing to npm without tag'
118+
lerna exec --ignore '@('${IGNORE}')' -- npm publish 2>&1
119+
else
120+
echo "Publishing to npm with tag ${TAG}"
121+
lerna exec --ignore '@('${IGNORE}')' -- npm publish --tag="${TAG}" 2>&1
122+
fi
138123
else
139124
echo "All npm modules with tag ${VERSION} exist, skipping publish phase"
140125
fi
@@ -168,17 +153,24 @@ set -e
168153
# Conditionally build, tag, and publish Docker images based on the resulting array
169154
for i in ${PUBLISH_DOCKER_IMAGES[@]}; do
170155

171-
# Build the image and tag it with the version and unstable.
156+
# Build the image, and tag if required
172157
docker build --build-arg VERSION=${VERSION} -t hyperledger/${i}:${VERSION} ${DIR}/packages/${i}/docker
173-
docker tag hyperledger/${i}:${VERSION} hyperledger/${i}:"${TAG}"
158+
if [ ! -z "${TAG}" ]; then
159+
docker tag hyperledger/${i}:${VERSION} hyperledger/${i}:"${TAG}"
160+
fi
174161

175-
# Push both the version and unstable.
162+
# Push the image, and tagged version if required
176163
docker push hyperledger/${i}:${VERSION}
177-
docker push hyperledger/${i}:${TAG}
164+
if [ ! -z "${TAG}" ]; then
165+
docker push hyperledger/${i}:${TAG}
166+
fi
178167
done
179168

180-
# Push to public Bluemix for stable and unstable, latest and next release builds
181-
if [[ "${BUILD_FOCUS}" == 'latest' ]]; then
169+
# Push latest stable and unstable versions to public Bluemix
170+
if [ "${BUILD_FOCUS}" = 'latest' ]; then
171+
[ "${BUILD_RELEASE}" = 'stable' ] && PLAYGROUND_SUFFIX='' || PLAYGROUND_SUFFIX='-unstable'
172+
WEB_CFG="{\"webonly\":true}"
173+
182174
pushd ${DIR}/packages/composer-playground
183175
rm -rf ${DIR}/packages/composer-playground/node_modules
184176
cf login -a https://api.ng.bluemix.net -u ${CF_USERNAME} -p ${CF_PASSWORD} -o ${CF_ORGANIZATION} -s ${CF_SPACE}
@@ -189,7 +181,7 @@ if [[ "${BUILD_FOCUS}" == 'latest' ]]; then
189181
fi
190182

191183

192-
## Stable releases only; both latest and next then clean up git, and bump version number
184+
## Stable releases only: clean up git, and bump version number
193185
if [[ "${BUILD_RELEASE}" = "stable" ]]; then
194186

195187
# Configure the Git repository and clean any untracked and unignored build files.
@@ -210,5 +202,4 @@ if [[ "${BUILD_RELEASE}" = "stable" ]]; then
210202

211203
fi
212204

213-
214205
_exit "All complete" 0

packages/composer-website/scripts/run-jekyll.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
#
1515

16-
if [ $# < 3 ]; then
16+
if [ $# -lt 3 ]; then
1717
echo 'Arguments: <jekyll-command> <docs-dir> <build-label> [<jekyll-arg> ...]'
1818
exit 1
1919
fi

0 commit comments

Comments
 (0)