| #!/usr/bin/env bash |
| |
| set -u -e -o pipefail |
| |
| # Publishes our npm packages |
| # To dry-run: |
| # ./scripts/publish_release.sh pack |
| # To verify: |
| # for p in $(ls packages); do if [[ -d packages/$p ]]; then b="@bazel/$p"; echo -ne "\n$b\n-------\n"; npm dist-tag ls $b; fi; done |
| # Googlers: you should npm login using the go/npm-publish service: |
| # $ npm login --registry https://wombat-dressing-room.appspot.com |
| |
| readonly NPM_COMMAND=${1:-publish} |
| readonly NPM_TAG=${2:-latest} |
| readonly BAZEL=./node_modules/.bin/bazel |
| readonly PKG_NPM_LABELS=`$BAZEL query --output=label 'kind("pkg_npm rule", //packages/...) - attr("tags", "\[.*do-not-publish.*\]", //packages/...)'` |
| |
| $BAZEL build --config=release $PKG_NPM_LABELS |
| # publish one package at a time to make it easier to spot any errors or warnings |
| for pkg in $PKG_NPM_LABELS ; do |
| $BAZEL run --config=release -- ${pkg}.${NPM_COMMAND} --access public --tag ${NPM_TAG} ${NPM_REGISTRY:-} |
| done |