Skip to content

Commit bf23260

Browse files
devversionmmalerba
authored andcommitted
build: use node to resolve build version (#5460)
* instead of using a complex RegExp that will likely break at some point in the future, we are switching to a single-line NodeJS script to resolve the version.
1 parent 17d6346 commit bf23260

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

scripts/deploy/publish-build-artifacts.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ set -e
99
# Go to the project root directory
1010
cd $(dirname ${0})/../..
1111

12+
if [ -z ${MATERIAL2_BUILDS_TOKEN} ]; then
13+
echo "Error: No access token for GitHub could be found." \
14+
"Please set the environment variable 'MATERIAL2_BUILDS_TOKEN'."
15+
exit 1
16+
fi
17+
1218
# Material packages that need to published.
1319
PACKAGES=(cdk material)
1420
REPOSITORIES=(cdk-builds material2-builds)
@@ -24,7 +30,7 @@ publishPackage() {
2430
packageRepo=${2}
2531

2632
buildDir="dist/releases/${packageName}"
27-
buildVersion=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)
33+
buildVersion=$(node -pe "require('./package.json').version")
2834

2935
commitSha=$(git rev-parse --short HEAD)
3036
commitAuthorName=$(git --no-pager show -s --format='%an' HEAD)
@@ -72,7 +78,7 @@ publishPackage() {
7278
git tag "${buildVersion}-${commitSha}"
7379
git push origin master --tags
7480

75-
echo "Published artifacts for ${packageName} package."
81+
echo "Published package artifacts for ${packageName}#${commitSha}."
7682
}
7783

7884
for ((i = 0; i < ${#PACKAGES[@]}; i++)); do

scripts/deploy/publish-docs-content.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ set -e
88

99
cd "$(dirname $0)/../../"
1010

11+
if [ -z ${MATERIAL2_DOCS_CONTENT_TOKEN} ]; then
12+
echo "Error: No access token for GitHub could be found." \
13+
"Please set the environment variable 'MATERIAL2_DOCS_CONTENT_TOKEN'."
14+
exit 1
15+
fi
16+
1117
docsPath="./dist/docs"
1218
packagePath="./dist/releases/material-examples"
1319
repoPath="/tmp/material2-docs-content"

0 commit comments

Comments
 (0)