Skip to content

Commit 79d0ed9

Browse files
author
姚世权
committed
draft
1 parent c8d5a1b commit 79d0ed9

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

update-version.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ update_pom_modules=()
1414
for current_module_path in $all_module_paths; do
1515
for changed_module_path in $changed_module_paths; do
1616
if [[ "$changed_module_path" == "$current_module_path"* ]]; then
17-
#echo $current_module_path"/pom.xml"
18-
update_pom_modules+=($current_module_path)
17+
#echo "$current_module_path/pom.xml"
18+
update_pom_modules+=("$current_module_path")
1919
break
2020
fi
2121
done
2222
done
2323

2424
project_path=$(readlink -f ".")
25-
echo $project_path
25+
echo "$project_path"
2626
root_version=""
2727
for module_path in "${update_pom_modules[@]}"; do
28-
cd $module_path
28+
cd "$module_path" || exit
2929
artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)
3030
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
3131
new_version=$(echo $version | awk -F'[.]' '{printf "%d.%d.%d", $1, $2, $3+1}')
@@ -35,19 +35,17 @@ for module_path in "${update_pom_modules[@]}"; do
3535
fi
3636
# -DprocessDependencies=false
3737
mvn versions:set -q -DnewVersion=$new_version -DartifactId=$artifact_id -DgenerateBackupPoms=false -DupdateMatchingVersions=false
38-
cd $project_path
38+
cd "$project_path" || exit
3939
done
4040

4141
echo "Auto-increment version: $root_version"
4242

43-
temp_name="GitHub Actions Robot"
44-
temp_email="1127664027@qq.com"
4543
old_name=$(git config --local user.name)
4644
old_email=$(git config --local user.email)
47-
git config --local user.name "$temp_name"
48-
git config --local user.email "$temp_email"
45+
git config --local user.name "GitHub Actions Robot"
46+
git config --local user.email "1127664027@qq.com"
4947
git status --porcelain | grep 'pom.xml$' | awk '{print $2}' | xargs git add
50-
git commit --author="$temp_name <$temp_email>" -m "Auto-increment version: $root_version"
48+
git commit -m "Auto-increment version: $root_version"
5149
git push
5250
git config --local user.name "$old_name"
5351
git config --local user.email "$old_email"

0 commit comments

Comments
 (0)