-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Fred Bricon <[email protected]>
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
# Path to your gradle.properties file | ||
GRADLE_PROPERTIES_FILE="gradle.properties" | ||
|
||
# Read the current version from gradle.properties | ||
CURRENT_VERSION=$(grep "pluginVersion=" "$GRADLE_PROPERTIES_FILE" | cut -d'=' -f2) | ||
|
||
# Extract the version part before any hyphen | ||
BASE_VERSION=$(echo "$CURRENT_VERSION" | awk -F'-' '{print $1}') | ||
|
||
# Replace any suffix following a hyphen with a timestamp in the format YYYYMMDD-HHmmSS | ||
TIMESTAMP=$(date +'%Y%m%d-%H%M%S') | ||
NEW_VERSION="${BASE_VERSION}-$TIMESTAMP" | ||
|
||
# Use awk to update the gradle.properties file | ||
awk -v new_version="$NEW_VERSION" '/pluginVersion=/{sub(/=.*/, "=" new_version)}1' "$GRADLE_PROPERTIES_FILE" > tmpfile && mv tmpfile "$GRADLE_PROPERTIES_FILE" | ||
|
||
echo $NEW_VERSION |
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,22 @@ | ||
#!/bin/bash | ||
|
||
# Path to your gradle.properties file | ||
GRADLE_PROPERTIES_FILE="gradle.properties" | ||
|
||
# Read the current version from gradle.properties | ||
CURRENT_VERSION=$(grep "pluginVersion=" "$GRADLE_PROPERTIES_FILE" | cut -d'=' -f2) | ||
|
||
# Extract version parts | ||
IFS="-" read -ra VERSION_PARTS <<< "$CURRENT_VERSION" | ||
IFS="." read -ra VERSION_NUM <<< "${VERSION_PARTS[0]}" | ||
|
||
# Increment the last digit | ||
((VERSION_NUM[2]++)) | ||
|
||
# Assemble the new version | ||
NEW_VERSION="${VERSION_NUM[0]}.${VERSION_NUM[1]}.${VERSION_NUM[2]}-SNAPSHOT" | ||
|
||
# Use awk to update the gradle.properties file | ||
awk -v new_version="$NEW_VERSION" '/pluginVersion=/{sub(/=.*/, "=" new_version)}1' "$GRADLE_PROPERTIES_FILE" > tmpfile && mv tmpfile "$GRADLE_PROPERTIES_FILE" | ||
|
||
echo $NEW_VERSION |
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,14 @@ | ||
#!/bin/bash | ||
|
||
GRADLE_PROPERTIES_FILE="gradle.properties" | ||
|
||
# Read the current version from gradle.properties | ||
CURRENT_VERSION=$(grep "pluginVersion=" "$GRADLE_PROPERTIES_FILE" | cut -d'=' -f2) | ||
|
||
# Remove the "-SNAPSHOT" suffix from the current version | ||
NEW_VERSION=${CURRENT_VERSION%-SNAPSHOT} | ||
|
||
# Update the gradle.properties file with the new version | ||
awk -v current="$CURRENT_VERSION" -v new="$NEW_VERSION" 'BEGIN {FS=OFS="="} $1 == "pluginVersion" { $2 = new }1' "$GRADLE_PROPERTIES_FILE" > tmpfile && mv tmpfile "$GRADLE_PROPERTIES_FILE" | ||
|
||
echo $NEW_VERSION |