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

Commit

Permalink
skip npm publish if all modules exist (#4178)
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Lincoln <[email protected]>
  • Loading branch information
nklincoln authored and fabric-composer-app committed Jun 21, 2018
1 parent a041b6b commit 25e5031
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ set-up-ssh --key "$encrypted_17b59ce72ad7_key" \
--path-encrypted-key ".travis/github_deploy_key.enc"

# This is the list of all npm modules for composer to be published
export ALL_NPM_MODULES="composer-admin composer-cli composer-client composer-common composer-connector-embedded composer-connector-hlfv1 composer-connector-proxy composer-connector-server composer-connector-web composer-cucumber-steps composer-documentation composer-playground composer-playground-api composer-report composer-rest-server composer-runtime composer-runtime-embedded composer-runtime-hlfv1 composer-runtime-pouchdb composer-runtime-web composer-wallet-filesystem composer-wallet-inmemory generator-hyperledger-composer loopback-connector-composer"
export ALL_NPM_MODULES=("composer-admin composer-cli composer-client composer-common composer-connector-embedded composer-connector-hlfv1 composer-connector-proxy composer-connector-server composer-connector-web composer-cucumber-steps composer-documentation composer-playground composer-playground-api composer-report composer-rest-server composer-runtime composer-runtime-embedded composer-runtime-hlfv1 composer-runtime-pouchdb composer-runtime-web composer-wallet-filesystem composer-wallet-inmemory generator-hyperledger-composer loopback-connector-composer")

# This is the list of npm modules required by docker images
export DOCKER_NPM_MODULES="composer-admin composer-client composer-cli composer-common composer-report composer-playground composer-playground-api composer-rest-server loopback-connector-composer composer-wallet-filesystem composer-wallet-inmemory composer-connector-server composer-documentation composer-connector-hlfv1 composer-connector-proxy"
Expand Down Expand Up @@ -119,20 +119,27 @@ fi
export VERSION=$(node -e "console.log(require('${DIR}/package.json').version)")

# Determine which npm modules to ignore on the publish
export IGNORE_NPM_MODULES=();
export IGNORE="composer-tests-integration|composer-tests-functional|composer-website"
for m in ${ALL_NPM_MODULES}; do
for m in "${ALL_NPM_MODULES[@]}"; do
echo "Checking for existence of npm module ${m}"
if npm view ${m}@${VERSION} | grep dist-tags > /dev/null 2>&1; then
echo "-module ${m} exists, will ignore in publish"
IGNORE_NPM_MODULES+=("${m}")
IGNORE+="|${m}"
fi
done

# Publish with tag
echo "Pushing with tag ${TAG}"
lerna exec --ignore '@('${IGNORE}')' -- npm publish --tag="${TAG}" 2>&1
# 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
else
echo "All npm modules with tag ${VERSION} exist, skipping publish phase"
fi

# Check that all required modules have been published to npm and are retrievable
# Check that all required modules for docker have been published to npm and are retrievable
for j in ${DOCKER_NPM_MODULES}; do
# check the next in the list
while ! npm view ${j}@${VERSION} | grep dist-tags > /dev/null 2>&1; do
Expand Down

0 comments on commit 25e5031

Please sign in to comment.