forked from loafle/openapi-generator-original
Merge pull request #939 from cbornet/linux_release_scripts
Make release script cross-compatible between Mac and Linux
This commit is contained in:
commit
aceec7a5a2
@ -31,8 +31,6 @@ else
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
echo "IMPORTANT: this script works on Mac only"
|
||||
echo "Release preparation: replacing $FROM with $TO in different files"
|
||||
|
||||
declare -a files=("CI/pom.xml.bash"
|
||||
@ -48,10 +46,15 @@ declare -a files=("CI/pom.xml.bash"
|
||||
"samples/meta-codegen/lib/pom.xml"
|
||||
"pom.xml")
|
||||
|
||||
sedi () {
|
||||
# Cross-platform version of sed -i that works both on Mac and Linux
|
||||
sed --version >/dev/null 2>&1 && sed -i -e "$@" || sed -i "" "$@"
|
||||
}
|
||||
|
||||
for filename in "${files[@]}"; do
|
||||
# e.g. sed -i '' "s/3.0.1-SNAPSHOT/3.0.1/g" CI/pom.xml.bash
|
||||
#echo "Running command: sed -i '' "s/$FROM/$TO/g" $filename"
|
||||
if sed -i '' "s/$FROM/$TO/g" $filename; then
|
||||
if sedi "s/$FROM/$TO/g" $filename; then
|
||||
echo "Updated $filename successfully!"
|
||||
else
|
||||
echo "ERROR: Failed to update $filename with the following command"
|
||||
|
@ -31,8 +31,6 @@ else
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
echo "IMPORTANT: this script works on Mac only"
|
||||
echo "Release preparation: replacing $FROM with $TO in different files"
|
||||
|
||||
declare -a files=("modules/openapi-generator-maven-plugin/README.md"
|
||||
@ -45,10 +43,15 @@ declare -a files=("modules/openapi-generator-maven-plugin/README.md"
|
||||
"modules/openapi-generator-gradle-plugin/samples/local-spec/README.md"
|
||||
"README.md")
|
||||
|
||||
sedi () {
|
||||
# Cross-platform version of sed -i that works both on Mac and Linux
|
||||
sed --version >/dev/null 2>&1 && sed -i -e "$@" || sed -i "" "$@"
|
||||
}
|
||||
|
||||
for filename in "${files[@]}"; do
|
||||
# e.g. sed -i '' "s/3.0.1-SNAPSHOT/3.0.1/g" CI/pom.xml.bash
|
||||
#echo "Running command: sed -i '' "s/$FROM/$TO/g" $filename"
|
||||
if sed -i '' "s/$FROM/$TO/g" $filename; then
|
||||
if sedi "s/$FROM/$TO/g" $filename; then
|
||||
echo "Updated $filename successfully!"
|
||||
else
|
||||
echo "ERROR: Failed to update $filename with the following command"
|
||||
|
Loading…
x
Reference in New Issue
Block a user