Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 54747e2

Browse files
Fix automatic NPM publish job in CircleCI
1 parent 0d736bf commit 54747e2

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

.circleci/config.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ docker_config: &docker_config
1616
version: 2.0
1717
workflows:
1818
version: 2
19-
test_and_publish:
19+
build:
2020
jobs:
2121
- test:
2222
filters: *release_tags
@@ -50,32 +50,10 @@ jobs:
5050
- run:
5151
name: Install modules and dependencies.
5252
command: npm install
53-
- run:
54-
name: Set NPM authentication.
55-
# Publish to NPM via the Google wombat bot that manages auth tokens,
56-
# so each token has authority to publish to just a single package.
57-
command: echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc
58-
- run: |
59-
cd packages/opencensus-web-all
60-
NPM_TOKEN="$WOMBAT_TOKEN_ALL"
61-
npm publish --registry https://wombat-dressing-room.appspot.com
62-
- run: |
63-
cd packages/opencensus-web-core
64-
NPM_TOKEN="$WOMBAT_TOKEN_CORE"
65-
npm publish --registry https://wombat-dressing-room.appspot.com
66-
- run: |
67-
cd packages/opencensus-web-exporter-ocagent
68-
NPM_TOKEN="$WOMBAT_TOKEN_EXPORTER_OCAGENT"
69-
npm publish --registry https://wombat-dressing-room.appspot.com
70-
- run: |
71-
cd packages/opencensus-web-instrumentation-perf
72-
NPM_TOKEN="$WOMBAT_TOKEN_INSTRUMENTATION_PERF"
73-
npm publish --registry https://wombat-dressing-room.appspot.com
74-
- run: |
75-
cd packages/opencensus-web-propagation-tracecontext
76-
NPM_TOKEN="$WOMBAT_TOKEN_PROPAGATION_TRACECONTEXT"
77-
npm publish --registry https://wombat-dressing-room.appspot.com
78-
- run: |
79-
cd packages/opencensus-web-types
80-
NPM_TOKEN="$WOMBAT_TOKEN_TYPES"
81-
npm publish --registry https://wombat-dressing-room.appspot.com
53+
# Run publish script for each package suffix and its NPM wombat token.
54+
- run: .circleci/publish.sh all $WOMBAT_TOKEN_ALL
55+
- run: .circleci/publish.sh core $WOMBAT_TOKEN_CORE
56+
- run: .circleci/publish.sh exporter-ocagent $WOMBAT_TOKEN_EXPORTER_OCAGENT
57+
- run: .circleci/publish.sh instrumentation-perf $WOMBAT_TOKEN_INSTRUMENTATION_PERF
58+
- run: .circleci/publish.sh propagation-tracecontext "$WOMBAT_TOKEN_PROPAGATION_TRACECONTEXT"
59+
- run: .circleci/publish.sh types "$WOMBAT_TOKEN_TYPES"

.circleci/publish.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Copyright 2019, OpenCensus Authors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http:#www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# Fail the script if any command fails
18+
set -e
19+
20+
PACKAGE_SUFFIX="$1"
21+
NPM_TOKEN="$2"
22+
23+
# Print each line of the script but don't expand variables.
24+
set -v
25+
26+
rm -f ~/.npmrc
27+
28+
# Publish to NPM via the Google wombat bot that manages auth tokens, so each
29+
# token has authority to publish to just a single package.
30+
echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc
31+
32+
cd "packages/opencensus-web-$PACKAGE_SUFFIX"
33+
34+
npm publish --registry https://wombat-dressing-room.appspot.com

0 commit comments

Comments
 (0)