2018-02-22 12:07:17 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#!/usr/bin/env bash
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-30 13:48:47 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								set -u -e -o pipefail
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-08 12:19:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Runs the pre-check before performing the publish to ensure
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# the version is valid for release.
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-29 12:40:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								sh "$(dirname "$0")/pre-check";
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-08 12:19:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 12:07:17 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Use for BETA and RC releases
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-30 13:48:47 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Query Bazel for npm_package and ng_package rules with tags=["release-with-framework"]
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-30 09:45:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Publish them to npm (tagged next)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-05 13:01:25 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-01 20:47:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# We need to resolve the Bazel binary in the node modules because running Bazel
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-18 22:40:26 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# through `yarn bazelisk` causes additional output that throws off the command stdout.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								BAZEL_BIN=$(yarn bin)/bazelisk
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 17:10:29 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Build into a distinct output location so that artifacts from previous builds are not reused
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								BAZEL_OUTPUT_BASE=$(mktemp -d -t angular-release-next.XXXXXXX)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								BAZEL="$BAZEL_BIN --output_base=$BAZEL_OUTPUT_BASE"
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-01 20:47:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-05 13:01:25 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# query for all npm packages to be released as part of the framework release
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-29 10:51:44 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								NPM_PACKAGE_LABELS=`${BAZEL_BIN} query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind("ng_package|pkg_npm", //packages/...)'`
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-05 13:01:25 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# build all npm packages in parallel
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 17:10:29 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								$BAZEL build --config=release $NPM_PACKAGE_LABELS
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-05 13:01:25 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# 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"
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-31 09:15:25 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  $BAZEL run --config=release -- ${packageLabel}.publish --access public --tag next
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-30 13:48:47 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								done
							 |