Skip to content

Commit

Permalink
Fix bug in docs build and publishing scripts (hyperledger-archives#4316)
Browse files Browse the repository at this point in the history
Signed-off-by: Mark S. Lewis <[email protected]>
  • Loading branch information
bestbeforetoday authored Aug 9, 2018
1 parent 8c65ea3 commit c754012
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 39 deletions.
67 changes: 29 additions & 38 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,35 +84,16 @@ git ls-remote
# Log in to Docker Hub.
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"

# Determine the details of the suffixes for playground and NPM/docker tags
if [[ "${BUILD_RELEASE}" == "unstable" ]]; then

if [ "${BUILD_RELEASE}" = 'unstable' ]; then
# Set the prerelease version.
npm run pkgstamp

if [[ "${BUILD_FOCUS}" == "latest" ]]; then
PLAYGROUND_SUFFIX="-unstable"
WEB_CFG="{\"webonly\":true}"
TAG="unstable"
elif [[ "${BUILD_FOCUS}" == "next" ]]; then
PLAYGROUND_SUFFIX="-next-unstable"
WEB_CFG="{\"webonly\":true}"
TAG="next-unstable"
else
_exit "Unknown build focus" 1
fi
elif [[ "${BUILD_RELEASE}" == "stable" ]]; then
if [[ "${BUILD_FOCUS}" == "latest" ]]; then
PLAYGROUND_SUFFIX=""
WEB_CFG="{\"webonly\":true}"
TAG="latest"
elif [[ "${BUILD_FOCUS}" == "next" ]]; then
PLAYGROUND_SUFFIX="-next"
WEB_CFG="{\"webonly\":true}"
TAG="next"
else
_exit "Unknown build focus" 1
fi
fi

# Which (if any) tag to use for npm and docker publish
if [ "${BUILD_FOCUS}" = 'latest' ]; then
[ "${BUILD_RELEASE}" = 'stable' ] && TAG='latest' || TAG='unstable'
else
TAG=''
fi

# Hold onto the version number
Expand All @@ -132,9 +113,13 @@ done

# Only enter here if ignore array is not same length as the publish array
if [ "${#ALL_NPM_MODULES[@]}" -ne "${#IGNORE_NPM_MODULES[@]}" ]; then
# Publish with tag
echo "Pushing with tag ${TAG}"
lerna exec --ignore '@('${IGNORE}')' -- npm publish --tag="${TAG}" 2>&1
if [ -z "${TAG}" ]; then
echo 'Publishing to npm without tag'
lerna exec --ignore '@('${IGNORE}')' -- npm publish 2>&1
else
echo "Publishing to npm with tag ${TAG}"
lerna exec --ignore '@('${IGNORE}')' -- npm publish --tag="${TAG}" 2>&1
fi
else
echo "All npm modules with tag ${VERSION} exist, skipping publish phase"
fi
Expand Down Expand Up @@ -168,17 +153,24 @@ set -e
# Conditionally build, tag, and publish Docker images based on the resulting array
for i in ${PUBLISH_DOCKER_IMAGES[@]}; do

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

# Push both the version and unstable.
# Push the image, and tagged version if required
docker push hyperledger/${i}:${VERSION}
docker push hyperledger/${i}:${TAG}
if [ ! -z "${TAG}" ]; then
docker push hyperledger/${i}:${TAG}
fi
done

# Push to public Bluemix for stable and unstable, latest and next release builds
if [[ "${BUILD_FOCUS}" == 'latest' ]]; then
# Push latest stable and unstable versions to public Bluemix
if [ "${BUILD_FOCUS}" = 'latest' ]; then
[ "${BUILD_RELEASE}" = 'stable' ] && PLAYGROUND_SUFFIX='' || PLAYGROUND_SUFFIX='-unstable'
WEB_CFG="{\"webonly\":true}"

pushd ${DIR}/packages/composer-playground
rm -rf ${DIR}/packages/composer-playground/node_modules
cf login -a https://api.ng.bluemix.net -u ${CF_USERNAME} -p ${CF_PASSWORD} -o ${CF_ORGANIZATION} -s ${CF_SPACE}
Expand All @@ -189,7 +181,7 @@ if [[ "${BUILD_FOCUS}" == 'latest' ]]; then
fi


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

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

fi


_exit "All complete" 0
2 changes: 1 addition & 1 deletion packages/composer-website/scripts/run-jekyll.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
#

if [ $# < 3 ]; then
if [ $# -lt 3 ]; then
echo 'Arguments: <jekyll-command> <docs-dir> <build-label> [<jekyll-arg> ...]'
exit 1
fi
Expand Down

0 comments on commit c754012

Please sign in to comment.