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

Commit

Permalink
Merge pull request #67 from census-instrumentation/release-tooling-fixes
Browse files Browse the repository at this point in the history
Fix automatic NPM publish job in CircleCI
  • Loading branch information
johnbryan authored Apr 29, 2019
2 parents 1dd9323 + 456b890 commit 5331b5f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 33 deletions.
38 changes: 8 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ docker_config: &docker_config
version: 2.0
workflows:
version: 2
test_and_publish:
build:
jobs:
- test:
filters: *release_tags
Expand Down Expand Up @@ -50,32 +50,10 @@ jobs:
- run:
name: Install modules and dependencies.
command: npm install
- run:
name: Set NPM authentication.
# Publish to NPM via the Google wombat bot that manages auth tokens,
# so each token has authority to publish to just a single package.
command: echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- run: |
cd packages/opencensus-web-all
NPM_TOKEN="$WOMBAT_TOKEN_ALL"
npm publish --registry https://wombat-dressing-room.appspot.com
- run: |
cd packages/opencensus-web-core
NPM_TOKEN="$WOMBAT_TOKEN_CORE"
npm publish --registry https://wombat-dressing-room.appspot.com
- run: |
cd packages/opencensus-web-exporter-ocagent
NPM_TOKEN="$WOMBAT_TOKEN_EXPORTER_OCAGENT"
npm publish --registry https://wombat-dressing-room.appspot.com
- run: |
cd packages/opencensus-web-instrumentation-perf
NPM_TOKEN="$WOMBAT_TOKEN_INSTRUMENTATION_PERF"
npm publish --registry https://wombat-dressing-room.appspot.com
- run: |
cd packages/opencensus-web-propagation-tracecontext
NPM_TOKEN="$WOMBAT_TOKEN_PROPAGATION_TRACECONTEXT"
npm publish --registry https://wombat-dressing-room.appspot.com
- run: |
cd packages/opencensus-web-types
NPM_TOKEN="$WOMBAT_TOKEN_TYPES"
npm publish --registry https://wombat-dressing-room.appspot.com
# Run publish script for each package suffix and its NPM wombat token.
- run: .circleci/publish.sh all $WOMBAT_TOKEN_ALL
- run: .circleci/publish.sh core $WOMBAT_TOKEN_CORE
- run: .circleci/publish.sh exporter-ocagent $WOMBAT_TOKEN_EXPORTER_OCAGENT
- run: .circleci/publish.sh instrumentation-perf $WOMBAT_TOKEN_INSTRUMENTATION_PERF
- run: .circleci/publish.sh propagation-tracecontext "$WOMBAT_TOKEN_PROPAGATION_TRACECONTEXT"
- run: .circleci/publish.sh types "$WOMBAT_TOKEN_TYPES"
34 changes: 34 additions & 0 deletions .circleci/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Copyright 2019, OpenCensus Authors
#
# 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.

# Fail the script if any command fails
set -e

PACKAGE_SUFFIX="$1"
NPM_TOKEN="$2"

# Print each line of the script but don't expand variables.
set -v

rm -f ~/.npmrc

# Publish to NPM via the Google wombat bot that manages auth tokens, so each
# token has authority to publish to just a single package.
echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc

cd "packages/opencensus-web-$PACKAGE_SUFFIX"

npm publish --registry https://wombat-dressing-room.appspot.com
5 changes: 2 additions & 3 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ draft notes are satisfactory.

## Merge and pull

Merge the PR, and pull the changes locally (using the commands in the first
step). Ensure that `chore(multiple): x.y.z release proposal` is the most recent
commit.
Merge the PR, and ensure that `chore(multiple): x.y.z release proposal` is the
most recent commit.

## Publish the GitHub Release

Expand Down

0 comments on commit 5331b5f

Please sign in to comment.