Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 6b4d116

Browse files
author
Keen Yee Liau
committed
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.
1 parent 01838b6 commit 6b4d116

File tree

4 files changed

+23
-35
lines changed

4 files changed

+23
-35
lines changed

docs/process/release.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ git push upstream && git push upstream --tags
1717
- Publish
1818
```sh
1919
# For release with 'next' tag
20-
./publish-next.sh
20+
./publish.sh next
2121
```
2222

2323
```sh
2424
# For release with 'latest' tag
25-
./publish.sh
25+
./publish.sh latest
2626
```
2727

2828
# Release Changelog

publish-next.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

publish.sh

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
21
#!/usr/bin/env bash
32

4-
set -u -e -o pipefail
3+
source $(dirname $0)/scripts/package-builder.sh
4+
5+
readonly tag="$1"
56

6-
# Use for BETA and RC releases
7-
# Query Bazel for npm_package and ng_package rules
8-
# Publish them to npm (tagged next)
7+
if [[ $tag != 'latest' && $tag != 'next' ]]; then
8+
echo "Invalid tag: ${tag}. Must be either 'latest' or 'next'"
9+
exit 1
10+
fi
911

10-
# query for all npm packages to be released as part of the framework release
11-
NPM_PACKAGE_LABELS=`bazel query --output=label 'attr("tags", "\[.*release.*\]", //modules/...) intersect kind(".*_package", //modules/...)'`
12-
# build all npm packages in parallel
13-
bazel build --config=release $NPM_PACKAGE_LABELS
12+
# Build the npm packages
13+
buildTargetPackages "dist/modules-dist" "legacy" "Production"
1414

15-
# publish all packages in sequence to make it easier to spot any errors or warnings
16-
for packageLabel in $NPM_PACKAGE_LABELS; do
17-
echo "publishing $packageLabel"
18-
bazel run --config=release -- ${packageLabel}.publish --access public --tag latest
15+
# Publish all packages to NPM
16+
for target in $(getAllPackages); do
17+
echo "=============================================="
18+
echo "Publishing ${target}"
19+
echo "=============================================="
20+
${bazel_bin} run --config=release "${target}.publish" -- \
21+
--access public --tag "${tag}"
1922
done

scripts/package-builder.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ readonly base_dir=$(pwd)/..
2222
readonly bazel_bin=$(yarn bin)/bazel
2323
readonly bin=$(${bazel_bin} info bazel-bin)
2424

25+
function getAllPackages() {
26+
${bazel_bin} query --output=label 'attr("tags", "\[.*release\]", //modules/...) intersect kind("pkg_npm|ng_package", //modules/...)'
27+
}
28+
2529
function buildTargetPackages() {
2630
# List of targets to build, e.g. core, common, compiler, etc.
27-
targets=$(${bazel_bin} query --output=label 'attr("tags", "\[.*release\]", //modules/...) intersect kind("pkg_npm|ng_package", //modules/...)')
31+
targets=$(getAllPackages)
2832

2933
# Path to the output directory into which we copy the npm packages.
3034
dest_path="$1"

0 commit comments

Comments
 (0)