-
Notifications
You must be signed in to change notification settings - Fork 0
/
replace.sh
executable file
·42 lines (35 loc) · 996 Bytes
/
replace.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
set -e
if [ "$(uname)" == "Darwin" ]; then
sed=gsed
fi
find . -name 'pom.xml' -type f -exec $sed -i'' -e '
/<artifactId>bom-2.361.x<\/artifactId>/{
N
/<artifactId>[^<]*<\/artifactId>/{
s/<artifactId>[^<]*<\/artifactId>/<artifactId>bom-2.387.x<\/artifactId>/
}
}
/<jenkins.version>2.361.4<\/jenkins.version>/{
N
/<jenkins.version>[^<]*<\/jenkins.version>/{
s/<jenkins.version>[^<]*<\/jenkins.version>/<jenkins.version>2.387.3<\/jenkins.version>/
}
}
' {} +
if git diff --exit-code > /dev/null
then
echo "No replacements required"
exit
fi
if grep -q '<artifactId>plugin</artifactId>' pom.xml
then
mvn versions:update-parent -DparentVersion=4.64
rm -f pom.xml.versionsBackup
fi
spotless_disabled=$(mvn help:evaluate -Dexpression=spotless.check.skip -q -DforceStdout)
if ! $spotless_disabled; then
mvn spotless:apply
fi
git status
echo "Replacement completed."