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

Commit 25e5031

Browse files
nklincolnfabric-composer-app
authored andcommitted
skip npm publish if all modules exist (#4178)
Signed-off-by: Nick Lincoln <[email protected]>
1 parent a041b6b commit 25e5031

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

.travis/deploy.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ set-up-ssh --key "$encrypted_17b59ce72ad7_key" \
6565
--path-encrypted-key ".travis/github_deploy_key.enc"
6666

6767
# This is the list of all npm modules for composer to be published
68-
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"
68+
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")
6969

7070
# This is the list of npm modules required by docker images
7171
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"
@@ -119,20 +119,27 @@ fi
119119
export VERSION=$(node -e "console.log(require('${DIR}/package.json').version)")
120120

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

131-
# Publish with tag
132-
echo "Pushing with tag ${TAG}"
133-
lerna exec --ignore '@('${IGNORE}')' -- npm publish --tag="${TAG}" 2>&1
133+
# Only enter here if ignore array is not same length as the publish array
134+
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
138+
else
139+
echo "All npm modules with tag ${VERSION} exist, skipping publish phase"
140+
fi
134141

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

0 commit comments

Comments
 (0)