-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: correctly tag when bumping the version of the package (#47)
The "npm version" command does not commit changes when used to bump the version of a workspace. So, introduce a script that create the commit and the tag.
- Loading branch information
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! /usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# inspired by https://github.com/textbook/fauxauth/blob/v8.1.5/bin/version.sh | ||
|
||
if [ $# -ne 2 ]; then | ||
echo "usage: ./bin/version.bash <package> <version>" | ||
echo "This will update the version for the give package" | ||
exit 1 | ||
fi | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
echo 'Git working directory not clean.' | ||
exit 1 | ||
fi | ||
|
||
packageName=$1 | ||
npmVersion=$2 | ||
|
||
echo "Bumping package ${packageName} to ${npmVersion}" | ||
npm version ${npmVersion} --no-git-tag-version -w packages/${packageName} | ||
|
||
VERSION=`node -p "require('./packages/${packageName}/package.json').version"` | ||
echo "New package version: ${VERSION}" | ||
|
||
echo "Committing and tagging..." | ||
git commit -a --message "chore(release): ${VERSION}" | ||
git tag "v${VERSION}" | ||
echo "Commit and tag done" |