Fix bump tool

This commit is contained in:
Cotes Chung 2021-01-27 03:17:00 +08:00
parent 08ce9f6c7c
commit c1b20d8f71

View file

@ -17,6 +17,8 @@ ASSETS=(
GEM_SPEC="jekyll-theme-chirpy.gemspec"
NODE_META="package.json"
bump_assets() {
_version="$1"
for i in ${!ASSETS[@]}; do
@ -27,13 +29,19 @@ bump_assets() {
}
bump_gemspec() {
_version="$1"
sed -i "s/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/$_version/" $GEM_SPEC
sed -i "s/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/$1/" $GEM_SPEC
}
bump_node() {
sed -i \
"s,[\"]version[\"]: [\"][[:digit:]]\.[[:digit:]]\.[[:digit:]][\"],\"version\": \"$1\"," \
$NODE_META
}
bump() {
bump_assets $1
bump_gemspec $1
bump_node $1
if [[ -n $(git status . -s) ]]; then
git add .