From e868d43ca3295d993ed735e024ec2844fede3da2 Mon Sep 17 00:00:00 2001 From: "yadong.zhang" Date: Tue, 24 Dec 2019 19:34:39 +0800 Subject: [PATCH] =?UTF-8?q?:egg:=20=E6=B7=BB=E5=8A=A0=E5=AE=9E=E7=94=A8?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=EF=BC=8C=E6=96=B9=E4=BE=BF=E6=AF=8F=E6=AC=A1?= =?UTF-8?q?=E5=8F=91=E7=89=88=E6=89=B9=E9=87=8F=E6=9B=B4=E6=96=B0=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 8 ++++++-- bin/repVersion.sh | 35 +++++++++++++++++++++++++++++++++++ bin/updVersion.sh | 19 +++++++++++++++++++ bin/version.txt | 1 + ja.sh | 20 ++++++++++++++++++++ 5 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 bin/repVersion.sh create mode 100644 bin/updVersion.sh create mode 100644 bin/version.txt create mode 100644 ja.sh diff --git a/.gitignore b/.gitignore index 4b73463..8666725 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,11 @@ hs_err_pid* # exclude idea files .idea *.iml -*.sh -bin/* +bin/codecov.sh +bin/deploy.sh +bin/docsify-cli.sh +bin/push.sh +bin/push-dev.sh target +/pom.xml.versionsBackup diff --git a/bin/repVersion.sh b/bin/repVersion.sh new file mode 100644 index 0000000..2277e8e --- /dev/null +++ b/bin/repVersion.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +#----------------------------------------------------------- +# 参考自 hutool 工具 +# 此脚本用于每次升级justauth时替换相应位置的版本号 +#----------------------------------------------------------- +pwd=$(pwd) +echo "当前路径:$pwd" + +if [ -n "$1" ];then + new_version="$1" + old_version=`cat $pwd/bin/version.txt` + echo "$old_version 替换为新版本 $new_version" +else + # 参数错误,退出 + echo "ERROR: 请指定新版本!" + exit +fi + +if [ ! -n "$old_version" ]; then + echo "ERROR: 旧版本不存在,请确认bin/version.txt中信息正确" + exit +fi + +# 替换README.md等文件中的版本 +sed -i "s/${old_version}/${new_version}/g" $pwd/README.md +sed -i "s/${old_version}/${new_version}/g" $pwd/README.en-US.md +sed -i "s/${old_version}/${new_version}/g" $pwd/docs/README.md +sed -i "s/${old_version}/${new_version}/g" $pwd/docs/_coverpage.md + +# 替换pom.xml中的版本 +sed -i "s/${old_version}/${new_version}/g" $pwd/pom.xml + +# 保留新版本号 +echo "$new_version" > $pwd/bin/version.txt diff --git a/bin/updVersion.sh b/bin/updVersion.sh new file mode 100644 index 0000000..07d3987 --- /dev/null +++ b/bin/updVersion.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +#------------------------------------------------ +# 参考自 hutool 工具 +# 升级justauth版本,包括: +# 1. 升级pom.xml中的版本号 +# 2. 替换README.md中的版本号 +#------------------------------------------------ + +if [ ! -n "$1" ]; then + echo "ERROR: 新版本不存在,请指定参数1" + exit +fi + +# 替换所有模块pom.xml中的版本 +mvn versions:set -DnewVersion=$1 + +# 替换其它地方的版本 +source $(pwd)/bin/repVersion.sh "$1" diff --git a/bin/version.txt b/bin/version.txt new file mode 100644 index 0000000..61ce01b --- /dev/null +++ b/bin/version.txt @@ -0,0 +1 @@ +1.13.2 diff --git a/ja.sh b/ja.sh new file mode 100644 index 0000000..6d753b1 --- /dev/null +++ b/ja.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# 参考自 hutool 工具 +help(){ + echo "--------------------------------------------------------------------------" + echo "" + echo "usage: ./ja.sh [updv]" + echo "" + echo "-updv [version num] Update all justauth related versions." + echo "" + echo "--------------------------------------------------------------------------" +} + +case "$1" in + 'updv') + bin/updVersion.sh $2 + ;; + *) + help +esac -- GitLab