Add a modification to Gemfile.lock in bump tool

This commit is contained in:
Cotes Chung 2021-02-05 01:41:35 +08:00
parent 5669f792a7
commit ba6c7eceec

View file

@ -5,16 +5,20 @@
# - assets/js/.copyright.js # - assets/js/.copyright.js
# - assets/js/dist/*.js (will be built by gulp later) # - assets/js/dist/*.js (will be built by gulp later)
# - jekyll-theme-chirpy.gemspec # - jekyll-theme-chirpy.gemspec
# - Gemfile.lock
# - package.json # - package.json
# #
# 2. Create a git-tag # 2. Create a git-tag on release branch
# #
# 3. Build a rubygem package # 3. Build a rubygem package
# #
#
# Requires: gulp, rubygem # Requires: gulp, rubygem
set -eu set -eu
auto_release=true
ASSETS=( ASSETS=(
"_sass/jekyll-theme-chirpy.scss" "_sass/jekyll-theme-chirpy.scss"
"assets/js/.copyright" "assets/js/.copyright"
@ -22,6 +26,8 @@ ASSETS=(
GEM_SPEC="jekyll-theme-chirpy.gemspec" GEM_SPEC="jekyll-theme-chirpy.gemspec"
GEM_LOCK="Gemfile.lock"
NODE_META="package.json" NODE_META="package.json"
_check_src() { _check_src() {
@ -54,26 +60,33 @@ check() {
_bump_assets() { _bump_assets() {
_version="$1" _version="$1"
for i in "${!ASSETS[@]}"; do for i in "${!ASSETS[@]}"; do
sed -i "s/v[[:digit:]]\.[[:digit:]]\.[[:digit:]]/v$_version/" "${ASSETS[$i]}" sed -i "s/v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/v$_version/" "${ASSETS[$i]}"
done done
gulp gulp
} }
_bump_gemspec() { _bump_gemspec() {
sed -i "s/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/$1/" "$GEM_SPEC" sed -i "s/[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/$1/" "$GEM_SPEC"
} }
_bump_node() { _bump_node() {
sed -i \ sed -i \
"s,[\"]version[\"]: [\"][[:digit:]]\.[[:digit:]]\.[[:digit:]][\"],\"version\": \"$1\"," \ "s,[\"]version[\"]: [\"][[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+[\"],\"version\": \"$1\"," \
$NODE_META $NODE_META
} }
_bump_gemlock() {
sed -i \
"s/jekyll-theme-chirpy ([[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/jekyll-theme-chirpy ($1/" \
$GEM_LOCK
}
bump() { bump() {
_bump_assets "$1" _bump_assets "$1"
_bump_gemspec "$1" _bump_gemspec "$1"
_bump_node "$1" _bump_node "$1"
_bump_gemlock "$1"
if [[ -n $(git status . -s) ]]; then if [[ -n $(git status . -s) ]]; then
git add . git add .
@ -143,7 +156,10 @@ main() {
bump "$_version" bump "$_version"
echo -e "Release to v$_version\n" echo -e "Release to v$_version\n"
release "$_version"
if $auto_release; then
release "$_version"
fi
else else
echo "Error: Illegal version number: '$_version'" echo "Error: Illegal version number: '$_version'"
@ -151,4 +167,18 @@ main() {
} }
while (($#)); do
opt="$1"
case $opt in
-m | --manual)
auto_release=false
shift
;;
*)
echo "unknown option '$opt'!"
exit 1
;;
esac
done
main main