angular-cn/scripts/release/publish-latest
Joey Perrott cebd4fada7 build: use sh instead of exec for release scripts (#36862)
Previously the exec command was used, however the exec command would
exit the original calling script regardless of the whether exit was
called.  This caused the release script to always exit after the
pre-check phase.

PR Close #36862
2020-04-29 13:04:43 -07:00

29 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -u -e -o pipefail
# Runs the pre-check before performing the publish to ensure
# the version is valid for release.
sh "$(dirname "$0")/pre-check";
# Use for production releases
# Query Bazel for npm_package and ng_package rules with tags=["release-with-framework"]
# Publish them to npm (tagged next)
# We need to resolve the Bazel binary in the node modules because running Bazel
# through `yarn bazelisk` causes additional output that throws off the command stdout.
BAZEL_BIN=$(yarn bin)/bazelisk
# Build into a distinct output location so that artifacts from previous builds are not reused
BAZEL_OUTPUT_BASE=$(mktemp -d -t angular-release-latest.XXXXXXX)
BAZEL="$BAZEL_BIN --output_base=$BAZEL_OUTPUT_BASE"
# query for all npm packages to be released as part of the framework release
NPM_PACKAGE_LABELS=`${BAZEL_BIN} query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind("ng_package|pkg_npm", //packages/...)'`
# build all npm packages in parallel
$BAZEL build --config=release $NPM_PACKAGE_LABELS
# publish all packages in sequence to make it easier to spot any errors or warnings
for packageLabel in $NPM_PACKAGE_LABELS; do
echo "publishing $packageLabel"
$BAZEL run --config=release -- ${packageLabel}.publish --access public --tag latest
done