Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/build_number.txt
/.shellspec-quick.log
package.json
.DS_Store
2 changes: 1 addition & 1 deletion .shellspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# kcov (coverage) options
--kcov-options "--include-pattern=build-poetry,get-build-number,pr_cleanup,promote,build-gradle,build-npm,build-maven"
--kcov-options "--include-pattern=build-poetry,get-build-number,pr_cleanup,promote,build-gradle,build-npm,build-maven,build-npm"
# --kcov-options "--exclude-pattern=.github,.idea,.git"

# define minimum coverage (fail otherwise)
Expand Down
18 changes: 12 additions & 6 deletions build-npm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,9 @@ set_project_version() {

check_version_format() {
local version="$1"
local extracted_points point_count

extracted_points="${version//[^.]}"
point_count=${#extracted_points}
if [[ "${point_count}" != 3 ]]; then
echo "WARN: Version '${version}' does not match the expected format '<MAJOR>.<MINOR>.<PATCH>.<BUILD_NUMBER>'." >&2
# Check if version follows semantic versioning pattern (X.Y.Z or X.Y.Z-something)
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
echo "WARN: Version '${version}' does not match semantic versioning format (e.g., '1.2.3' or '1.2.3-beta.1')." >&2
fi
}

Expand Down Expand Up @@ -251,6 +248,15 @@ build_npm() {
if [[ ${CURRENT_VERSION} =~ "-SNAPSHOT" ]]; then
echo "======= Found SNAPSHOT version ======="
echo "Set npm version with build ID: ${BUILD_NUMBER}."
# For maintenance branch SNAPSHOT, also set version with build number
release_version="${CURRENT_VERSION%"-SNAPSHOT"}"
digit_count=$(echo "${release_version//./ }" | wc -w)
if [ "${digit_count}" -lt 3 ]; then
release_version="${release_version}.0"
fi
PROJECT_VERSION="${release_version}-${BUILD_NUMBER}"
echo "Replacing version ${CURRENT_VERSION} with ${PROJECT_VERSION}"
npm version --no-git-tag-version --allow-same-version "${PROJECT_VERSION}"
check_version_format "${PROJECT_VERSION}"
else
echo "======= Found RELEASE version ======="
Expand Down
Loading