-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-1853396: Prepare new version script (#2013)
- Loading branch information
1 parent
0251382
commit d598a5a
Showing
2 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash -e | ||
|
||
if [[ -z "$1" ]]; then | ||
echo First argument must be new version to set | ||
exit 1 | ||
fi | ||
|
||
version=$1 | ||
|
||
# prepare release with maven | ||
./mvnw -f parent-pom.xml versions:set -DnewVersion=$version -DgenerateBackupPoms=false | ||
|
||
# update version in Driver code | ||
version_without_snapshot=${version%-*} | ||
file_with_version=src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java | ||
tmp_file_with_version=${file_with_version}.tmp | ||
sed -E "s/( implementVersion = )(.+)(;)/\1\"${version_without_snapshot}\"\3/" src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java > $tmp_file_with_version | ||
mv $tmp_file_with_version $file_with_version | ||
|
||
# add changelog entry but only when releasing version without snapshot | ||
if [[ "$version" == "$version_without_snapshot" ]]; then | ||
changelog_file=CHANGELOG.rst | ||
tmp_changelog_file=${changelog_file}.bck | ||
echo "**JDBC Driver ${version}**" > $tmp_changelog_file | ||
echo "" >> $tmp_changelog_file | ||
echo "- \||Please Refer to Release Notes at https://docs.snowflake.com/en/release-notes/clients-drivers/jdbc" >> $tmp_changelog_file | ||
echo "" >> $tmp_changelog_file | ||
cat $changelog_file >> $tmp_changelog_file | ||
mv $tmp_changelog_file $changelog_file | ||
fi |