angular/aio/scripts/build-artifacts.sh
Derek Cormier b6d80fb564 build(bazel): fix a bug where the opensearch url coudln't be substituted
The file was write protected in the bazel output tree.
2022-11-22 13:51:16 -07:00

28 lines
767 B
Bash
Executable file

#!/usr/bin/env bash
set -eu -o pipefail
readonly relativeOutputPath=$1
readonly prNumber=$2
readonly prLastSha=$3
readonly inputDir=../dist/bin/aio/build
readonly outputFile=$PROJECT_ROOT/$relativeOutputPath
readonly deployedUrl=https://pr${prNumber}-${prLastSha:0:7}.ngbuilds.io/
(
cd $PROJECT_ROOT/aio
# Build and store the app
yarn build
# Remove write protection from the opensearch.xml in the Bazel
# output tree so that the url can be substituted.
chmod u+w ../dist/bin/aio/build/assets/opensearch.xml
# Set deployedUrl as parameter in the opensearch description
# deployedUrl must end with /
yarn set-opensearch-url $deployedUrl
mkdir -p "`dirname $outputFile`"
tar --create --gzip --directory "$inputDir" --file "$outputFile" .
)