Skip to content

Commit 8da1a6e

Browse files
committed
Add branch check before bumping the project version
1 parent 5088340 commit 8da1a6e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tools/make/lib/node/npm.mk

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
# VARIABLES #
33

4-
# Define the version bump type:
4+
# Define the version bump type (e.g., pre-patch, patch, pre-minor, minor, pre-major, major, pre-release):
55
NPM_VERSION ?=
66

7-
# Define a commit message when incrementing the project version:
7+
# Define a git commit message when incrementing the project version:
88
NPM_VERSION_MESSAGE ?=
99

1010
# Define command-line options when incrementing the project version:
@@ -42,8 +42,15 @@ endif
4242
# Run pre-version tasks.
4343
#
4444
# This target runs tasks which should be completed before incrementing the project version.
45+
#
46+
# TODO: once we have a `master` branch, swap `develop` for `master`
4547

4648
npm-pre-version: dedupe-node-modules
49+
$(QUIET) if [[ "$(shell $(GIT_BRANCH))" != "develop" ]]; then \
50+
echo 'Error: invalid operation. New versions should only be performed on the `develop`'; \
51+
echo 'branch.'; \
52+
exit 1; \
53+
fi
4754

4855
.PHONY: npm-pre-version
4956

@@ -135,7 +142,9 @@ npm-version: $(npm_version_prerequisite)
135142

136143
npm-post-version:
137144
$(QUIET) echo ''
138-
$(QUIET) echo 'Incremented version and committed changes. If okay, run:'
145+
$(QUIET) echo 'Incremented version and committed changes.'
146+
$(QUIET) echo ''
147+
$(QUIET) echo 'If okay to publish, run:'
139148
$(QUIET) echo ''
140149
$(QUIET) echo ' $$ make npm-publish'
141150
$(QUIET) echo " $$ git push origin $(shell $(GIT_BRANCH)) && git push origin --tags"

0 commit comments

Comments
 (0)