Fix release script.
This commit is contained in:
parent
ea0bbf4d23
commit
7c336e56b6
29
bin/release
29
bin/release
@ -36,22 +36,25 @@ cmpnt_ver=$(find . -maxdepth 1 -name "component.json" | xargs cat | jq -r ".vers
|
|||||||
pkg_ver=$(find . -maxdepth 1 -name "package.json" | xargs cat | jq -r ".version")
|
pkg_ver=$(find . -maxdepth 1 -name "package.json" | xargs cat | jq -r ".version")
|
||||||
|
|
||||||
# Non npm package
|
# Non npm package
|
||||||
[ "$pkg_ver" == "0.0.0" ] && pkg=
|
[ "$pkg_ver" == "0.0.0" ] && pkg_ver=
|
||||||
|
|
||||||
# Verify current versions
|
# Verify current versions
|
||||||
current_ver=$jq_ver||$cmpnt_ver||$pck_ver
|
current_ver=
|
||||||
[ "$current_ver" == "" ] && current_ver="0.0.1"
|
[ -n "$jq_ver" ] && current_ver="$jq_ver"
|
||||||
|
[ -n "$cmpnt_ver" ] && current_ver="$cmpnt_ver"
|
||||||
|
[ -n "$pkg_ver" ] && current_ver="$pkg_ver"
|
||||||
|
[ -z "$current_ver" ] && current_ver="0.0.0"
|
||||||
|
|
||||||
# Validate current versions and determine new version
|
# Validate current versions and determine new version
|
||||||
if [ "$1" == "major" ] || [ "$1" == "minor" ] || [ "$1" == "patch" ]; then
|
if [ "$1" == "major" ] || [ "$1" == "minor" ] || [ "$1" == "patch" ]; then
|
||||||
dont_match="Versions in *.jquery.json, component.json and package.json don’t match."
|
dont_match="Versions in *.jquery.json, component.json and package.json don’t match."
|
||||||
if [ "$jq_ver" != "" ] && [ "$current_ver" != "$jq_ver" ]; then error dont_match; fi
|
if [ -n "$jq_ver" ] && [ "$current_ver" != "$jq_ver" ]; then error $dont_match; fi
|
||||||
if [ "$cmpnt_ver" != "" ] && [ "$current_ver" != "$cmpnt_ver" ]; then error dont_match; fi
|
if [ -n "$cmpnt_ver" ] && [ "$current_ver" != "$cmpnt_ver" ]; then error $dont_match; fi
|
||||||
if [ "$pck_ver" != "" ] && [ "$current_ver" != "$pck_ver" ]; then error dont_match; fi
|
if [ -n "$pkg_ver" ] && [ "$current_ver" != "$pkg_ver" ]; then error $dont_match; fi
|
||||||
else
|
else
|
||||||
new_ver="$1"
|
new_ver="$1"
|
||||||
fi
|
fi
|
||||||
if [ "$new_ver" == "" ]; then
|
if [ -z "$new_ver" ]; then
|
||||||
[ "$1" == "patch" ] && new_ver=$(semver -p $current_ver)
|
[ "$1" == "patch" ] && new_ver=$(semver -p $current_ver)
|
||||||
[ "$1" == "minor" ] && new_ver=$(semver -n $current_ver)
|
[ "$1" == "minor" ] && new_ver=$(semver -n $current_ver)
|
||||||
[ "$1" == "major" ] && new_ver=$(semver -m $current_ver)
|
[ "$1" == "major" ] && new_ver=$(semver -m $current_ver)
|
||||||
@ -60,18 +63,18 @@ fi
|
|||||||
header "Releasing v$new_ver..."
|
header "Releasing v$new_ver..."
|
||||||
|
|
||||||
# Update component.json
|
# Update component.json
|
||||||
if [ "$cmpnt_ver" != "" ]; then
|
if [ -n "$cmpnt_ver" ]; then
|
||||||
sed -i '' "s^$current_ver^$new_ver^" component.json
|
sed -i '' "s^$current_ver^$new_ver^" component.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update package.json
|
# Update package.json
|
||||||
if [ "$pck_ver" != "" ]; then
|
if [ -n "$pkg_ver" ]; then
|
||||||
sed -i '' "s^$current_ver^$pck_ver^" package.json
|
sed -i '' "s^$current_ver^$new_ver^" package.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update *.jquery.json
|
# Update *.jquery.json
|
||||||
if [ "$jq_ver" != "" ]; then
|
if [ -n "$jq_ver" ]; then
|
||||||
find . -maxdepth 1 -name "*.jquery.json" | xargs sed -i '' "s^$current_ver^$jq_ver^"
|
find . -maxdepth 1 -name "*.jquery.json" | xargs sed -i '' "s^$current_ver^$new_ver^"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build files
|
# Build files
|
||||||
@ -91,7 +94,7 @@ git tag "v$new_ver"
|
|||||||
git push origin --tags
|
git push origin --tags
|
||||||
|
|
||||||
# Publish npm package
|
# Publish npm package
|
||||||
if [ "$pck_ver" != "" ]; then
|
if [ -n "$pkg_ver" ]; then
|
||||||
npm publish
|
npm publish
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user