Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1853396: Prepare new version script #2013

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
sfc-gh-dprzybysz marked this conversation as resolved.
Show resolved Hide resolved

# 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
Loading