build: Update publish script

Update the publish script to invoke existing build command, then run the
script generated by Bazel npm_package target to publish to npm.
This commit is contained in:
Keen Yee Liau 2020-02-20 13:24:35 -08:00
parent 01838b6b0d
commit 6b4d116cce
4 changed files with 23 additions and 35 deletions

View File

@ -17,12 +17,12 @@ git push upstream && git push upstream --tags
- Publish
```sh
# For release with 'next' tag
./publish-next.sh
./publish.sh next
```
```sh
# For release with 'latest' tag
./publish.sh
./publish.sh latest
```
# Release Changelog

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
set -u -e -o pipefail
# Use for BETA and RC releases
# Query Bazel for npm_package and ng_package rules
# Publish them to npm (tagged next)
# query for all npm packages to be released as part of the framework release
NPM_PACKAGE_LABELS=`bazel query --output=label 'attr("tags", "\[.*release.*\]", //modules/...) intersect kind(".*_package", //modules/...)'`
# 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 next
done

View File

@ -1,19 +1,22 @@
#!/usr/bin/env bash
set -u -e -o pipefail
source $(dirname $0)/scripts/package-builder.sh
# Use for BETA and RC releases
# Query Bazel for npm_package and ng_package rules
# Publish them to npm (tagged next)
readonly tag="$1"
# query for all npm packages to be released as part of the framework release
NPM_PACKAGE_LABELS=`bazel query --output=label 'attr("tags", "\[.*release.*\]", //modules/...) intersect kind(".*_package", //modules/...)'`
# build all npm packages in parallel
bazel build --config=release $NPM_PACKAGE_LABELS
if [[ $tag != 'latest' && $tag != 'next' ]]; then
echo "Invalid tag: ${tag}. Must be either 'latest' or 'next'"
exit 1
fi
# 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
# Build the npm packages
buildTargetPackages "dist/modules-dist" "legacy" "Production"
# Publish all packages to NPM
for target in $(getAllPackages); do
echo "=============================================="
echo "Publishing ${target}"
echo "=============================================="
${bazel_bin} run --config=release "${target}.publish" -- \
--access public --tag "${tag}"
done

View File

@ -22,9 +22,13 @@ readonly base_dir=$(pwd)/..
readonly bazel_bin=$(yarn bin)/bazel
readonly bin=$(${bazel_bin} info bazel-bin)
function getAllPackages() {
${bazel_bin} query --output=label 'attr("tags", "\[.*release\]", //modules/...) intersect kind("pkg_npm|ng_package", //modules/...)'
}
function buildTargetPackages() {
# List of targets to build, e.g. core, common, compiler, etc.
targets=$(${bazel_bin} query --output=label 'attr("tags", "\[.*release\]", //modules/...) intersect kind("pkg_npm|ng_package", //modules/...)')
targets=$(getAllPackages)
# Path to the output directory into which we copy the npm packages.
dest_path="$1"