Skip to content

Commit d598a5a

Browse files
SNOW-1853396: Prepare new version script (#2013)
1 parent 0251382 commit d598a5a

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

README.rst

+8-5
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,20 @@ Run the maven ``verify`` goal.
195195
196196
where ``category`` is the class name under the package ``net.snowflake.client.category``.
197197

198-
Set new version
198+
Prepare new version
199199
---------------
200200

201-
1. Run maven command with passing specific version:
201+
Run script passing desired version:
202202

203203
.. code-block:: bash
204204
205-
mvn -f parent-pom.xml versions:set -DnewVersion=... -DgenerateBackupPoms=false
205+
./prepareNewVersion.sh 3.100.42
206206
207-
2. Set manually the same version in field ``implementVersion`` in ``src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java`` when it's version for release or without ``-SNAPSHOT`` suffix between releases
208-
3. Add entry in ``CHANGELOG.rst`` for release versions
207+
Add SNAPSHOT suffix when necessary:
208+
209+
.. code-block:: bash
210+
211+
./prepareNewVersion.sh 3.100.42-SNAPSHOT
209212
210213
Test Class Naming Convention
211214
----------------------------

prepareNewVersion.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash -e
2+
3+
if [[ -z "$1" ]]; then
4+
echo First argument must be new version to set
5+
exit 1
6+
fi
7+
8+
version=$1
9+
10+
# prepare release with maven
11+
./mvnw -f parent-pom.xml versions:set -DnewVersion=$version -DgenerateBackupPoms=false
12+
13+
# update version in Driver code
14+
version_without_snapshot=${version%-*}
15+
file_with_version=src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
16+
tmp_file_with_version=${file_with_version}.tmp
17+
sed -E "s/( implementVersion = )(.+)(;)/\1\"${version_without_snapshot}\"\3/" src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java > $tmp_file_with_version
18+
mv $tmp_file_with_version $file_with_version
19+
20+
# add changelog entry but only when releasing version without snapshot
21+
if [[ "$version" == "$version_without_snapshot" ]]; then
22+
changelog_file=CHANGELOG.rst
23+
tmp_changelog_file=${changelog_file}.bck
24+
echo "**JDBC Driver ${version}**" > $tmp_changelog_file
25+
echo "" >> $tmp_changelog_file
26+
echo "- \||Please Refer to Release Notes at https://docs.snowflake.com/en/release-notes/clients-drivers/jdbc" >> $tmp_changelog_file
27+
echo "" >> $tmp_changelog_file
28+
cat $changelog_file >> $tmp_changelog_file
29+
mv $tmp_changelog_file $changelog_file
30+
fi

0 commit comments

Comments
 (0)