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.
This commit is contained in:
Paul Gschwendtner
2017-07-05 19:30:34 +02:00
committed by mmalerba
parent 17d6346977
commit bf2326004a
2 changed files with 14 additions and 2 deletions
+8 -2
View File
@@ -9,6 +9,12 @@ set -e
# Go to the project root directory
cd $(dirname ${0})/../..
if [ -z ${MATERIAL2_BUILDS_TOKEN} ]; then
echo "Error: No access token for GitHub could be found." \
"Please set the environment variable 'MATERIAL2_BUILDS_TOKEN'."
exit 1
fi
# Material packages that need to published.
PACKAGES=(cdk material)
REPOSITORIES=(cdk-builds material2-builds)
@@ -24,7 +30,7 @@ publishPackage() {
packageRepo=${2}
buildDir="dist/releases/${packageName}"
buildVersion=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)
buildVersion=$(node -pe "require('./package.json').version")
commitSha=$(git rev-parse --short HEAD)
commitAuthorName=$(git --no-pager show -s --format='%an' HEAD)
@@ -72,7 +78,7 @@ publishPackage() {
git tag "${buildVersion}-${commitSha}"
git push origin master --tags
echo "Published artifacts for ${packageName} package."
echo "Published package artifacts for ${packageName}#${commitSha}."
}
for ((i = 0; i < ${#PACKAGES[@]}; i++)); do
+6
View File
@@ -8,6 +8,12 @@ set -e
cd "$(dirname $0)/../../"
if [ -z ${MATERIAL2_DOCS_CONTENT_TOKEN} ]; then
echo "Error: No access token for GitHub could be found." \
"Please set the environment variable 'MATERIAL2_DOCS_CONTENT_TOKEN'."
exit 1
fi
docsPath="./dist/docs"
packagePath="./dist/releases/material-examples"
repoPath="/tmp/material2-docs-content"