@@ -89,11 +89,13 @@ if [ "${BUILD_RELEASE}" = 'unstable' ]; then
8989 npm run pkgstamp
9090fi
9191
92- # Which (if any) tag to use for npm and docker publish
92+ # Which tag to use for npm and docker publish
9393if [ " ${BUILD_FOCUS} " = ' latest' ]; then
94- [ " ${BUILD_RELEASE} " = ' stable' ] && TAG=' latest' || TAG=' unstable'
94+ [ " ${BUILD_RELEASE} " = ' stable' ] && NPM_TAG=' latest' || NPM_TAG=' unstable'
95+ DOCKER_TAG=" ${NPM_TAG} "
9596else
96- TAG=' '
97+ [ " ${BUILD_RELEASE} " = ' stable' ] && NPM_TAG=' legacy' || NPM_TAG=' legacy-unstable'
98+ DOCKER_TAG=' '
9799fi
98100
99101# Hold onto the version number
@@ -113,13 +115,8 @@ done
113115
114116# Only enter here if ignore array is not same length as the publish array
115117if [ " ${# ALL_NPM_MODULES[@]} " -ne " ${# IGNORE_NPM_MODULES[@]} " ]; then
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
118+ echo " Publishing to npm with tag ${NPM_TAG} "
119+ lerna exec --ignore ' @(' ${IGNORE} ' )' -- npm publish --tag=" ${NPM_TAG} " 2>&1
123120else
124121 echo " All npm modules with tag ${VERSION} exist, skipping publish phase"
125122fi
@@ -155,14 +152,14 @@ for i in ${PUBLISH_DOCKER_IMAGES[@]}; do
155152
156153 # Build the image, and tag if required
157154 docker build --build-arg VERSION=${VERSION} -t hyperledger/${i} :${VERSION} ${DIR} /packages/${i} /docker
158- if [ ! -z " ${TAG } " ]; then
159- docker tag hyperledger/${i} :${VERSION} hyperledger/${i} :" ${TAG }"
155+ if [ ! -z " ${DOCKER_TAG } " ]; then
156+ docker tag " hyperledger/${i} :${VERSION} " " hyperledger/${i} :${DOCKER_TAG }"
160157 fi
161158
162159 # Push the image, and tagged version if required
163160 docker push hyperledger/${i} :${VERSION}
164- if [ ! -z " ${TAG } " ]; then
165- docker push hyperledger/${i} :${TAG}
161+ if [ ! -z " ${DOCKER_TAG } " ]; then
162+ docker push " hyperledger/${i} :${DOCKER_TAG} "
166163 fi
167164done
168165
0 commit comments