Skip to content

Commit

Permalink
SNOW-1853396: Prepare new version script
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz committed Dec 20, 2024
1 parent 0251382 commit 8bf94b0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
13 changes: 8 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,20 @@ Run the maven ``verify`` goal.
where ``category`` is the class name under the package ``net.snowflake.client.category``.

Set new version
Prepare new version
---------------

1. Run maven command with passing specific version:
Run script passing desired version:

.. code-block:: bash
mvn -f parent-pom.xml versions:set -DnewVersion=... -DgenerateBackupPoms=false
./prepareNewVersion.sh 3.100.42
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
3. Add entry in ``CHANGELOG.rst`` for release versions
Add SNAPSHOT suffix when necessary:

.. code-block:: bash
./prepareNewVersion.sh 3.100.42-SNAPSHOT
Test Class Naming Convention
----------------------------
Expand Down
30 changes: 30 additions & 0 deletions prepareNewVersion.sh
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

0 comments on commit 8bf94b0

Please sign in to comment.