From 6fa9b12f65291ddcc87abb0db3d31a599ada1959 Mon Sep 17 00:00:00 2001 From: Nick Lincoln Date: Tue, 5 Jan 2021 11:32:33 +0000 Subject: [PATCH] publish to npm stage (#1110) Signed-off-by: nkl199@yahoo.co.uk --- .build/{publish.sh => publish-docker.sh} | 1 - .build/publish-npm.sh | 28 ++++++++++++++++++++++++ azure-pipelines.yml | 16 ++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) rename .build/{publish.sh => publish-docker.sh} (98%) create mode 100755 .build/publish-npm.sh diff --git a/.build/publish.sh b/.build/publish-docker.sh similarity index 98% rename from .build/publish.sh rename to .build/publish-docker.sh index 48e8dfbad..d0868da43 100755 --- a/.build/publish.sh +++ b/.build/publish-docker.sh @@ -25,5 +25,4 @@ cp ./README.md ./packages/caliper-fisco-bcos/README.md cd ./packages/caliper-publish/ npm i -./publish.js npm ./publish.js docker --user klenik --publish diff --git a/.build/publish-npm.sh b/.build/publish-npm.sh new file mode 100755 index 000000000..467e68eed --- /dev/null +++ b/.build/publish-npm.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Exit on first error +set -e + +# distribute root README file before publishing +cp ./README.md ./packages/caliper-cli/README.md +cp ./README.md ./packages/caliper-core/README.md +cp ./README.md ./packages/caliper-ethereum/README.md +cp ./README.md ./packages/caliper-fabric/README.md +cp ./README.md ./packages/caliper-fisco-bcos/README.md + +cd ./packages/caliper-publish/ +npm i +./publish.js npm diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0d2d8c812..6cac0ff34 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -94,3 +94,19 @@ stages: displayName: 'Install Node.js' - script: | .build/benchmark-integration-test-direct.sh + +- stage: Publish + displayName: Publish Caliper + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.Reason'], 'IndividualCI')) + jobs: + - job: PublishNPM + displayName: 'Publish Caliper NPM packages' + steps: + - task: NodeTool@0 + inputs: + versionSpec: '10.x' + displayName: 'Install Node.js' + - script: .build/publish-npm.sh + displayName: Publish packages + env: + NPM_TOKEN: "$(npm)"