2019-08-14 10:02:32 +08:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
2023-03-27 03:28:19 +08:00
|
|
|
|
#
|
2025-01-01 23:44:09 +08:00
|
|
|
|
# Copyright (c) 2013-2025 Hutool Team and hutool.cn
|
2024-09-06 00:06:14 +08:00
|
|
|
|
#
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
2023-03-27 03:28:19 +08:00
|
|
|
|
#
|
|
|
|
|
|
2019-08-14 10:02:32 +08:00
|
|
|
|
#-----------------------------------------------------------
|
|
|
|
|
# 此脚本用于每次升级Hutool时替换相应位置的版本号
|
|
|
|
|
#-----------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
|
|
|
|
|
pwd=$(pwd)
|
|
|
|
|
|
|
|
|
|
echo "当前路径:${pwd}"
|
|
|
|
|
|
|
|
|
|
if [ -n "$1" ];then
|
|
|
|
|
new_version="$1"
|
2023-03-13 11:41:20 +08:00
|
|
|
|
old_version=$(cat "${pwd}"/bin/version.txt)
|
2019-08-14 10:02:32 +08:00
|
|
|
|
echo "$old_version 替换为新版本 $new_version"
|
|
|
|
|
else
|
|
|
|
|
# 参数错误,退出
|
|
|
|
|
echo "ERROR: 请指定新版本!"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
2023-03-13 11:41:20 +08:00
|
|
|
|
if [ -z "$old_version" ]; then
|
2019-08-14 10:02:32 +08:00
|
|
|
|
echo "ERROR: 旧版本不存在,请确认bin/version.txt中信息正确"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# 替换README.md中的版本
|
2023-03-13 11:41:20 +08:00
|
|
|
|
sed -i "s/${old_version}/${new_version}/g" "$pwd"/README.md
|
|
|
|
|
sed -i "s/${old_version}/${new_version}/g" "$pwd"/README-EN.md
|
2020-08-10 09:34:32 +08:00
|
|
|
|
# 替换docs/js/version.js中的版本
|
2023-03-13 11:41:20 +08:00
|
|
|
|
sed -i "s/${old_version}/${new_version}/g" "$pwd"/docs/js/version.js
|
2019-08-14 10:02:32 +08:00
|
|
|
|
|
|
|
|
|
# 保留新版本号
|
2023-03-13 11:41:20 +08:00
|
|
|
|
echo "$new_version" > "$pwd"/bin/version.txt
|