[Release script] Ensure that the release version will match the next Monday date.
This commit is contained in:
parent
82dd9a3f77
commit
6fc8e4357d
1 changed files with 9 additions and 6 deletions
|
|
@ -97,14 +97,17 @@ git pull
|
||||||
printf "\n================================================================================\n"
|
printf "\n================================================================================\n"
|
||||||
# Guessing version to propose a default version
|
# Guessing version to propose a default version
|
||||||
versionsFile="./plugins/src/main/kotlin/Versions.kt"
|
versionsFile="./plugins/src/main/kotlin/Versions.kt"
|
||||||
# Get current year on 2 digits
|
# The version of the release must match the date of next monday, where the release is supposed to go live
|
||||||
versionYearCandidate=$(date +%y)
|
# The command below gets the date of next monday
|
||||||
|
newtMondayDateCommand="date -v +1w -v -monday"
|
||||||
|
# Get release year on 2 digits
|
||||||
|
versionYearCandidate=$(${newtMondayDateCommand} +%y)
|
||||||
currentVersionMonth=$(grep "val versionMonth" ${versionsFile} | cut -d " " -f6)
|
currentVersionMonth=$(grep "val versionMonth" ${versionsFile} | cut -d " " -f6)
|
||||||
# Get current month on 2 digits
|
# Get release month on 2 digits
|
||||||
versionMonthCandidate=$(date +%m)
|
versionMonthCandidate=$(${newtMondayDateCommand} +%m)
|
||||||
versionMonthCandidateNoLeadingZero=${versionMonthCandidate/#0/}
|
versionMonthCandidateNoLeadingZero=${versionMonthCandidate/#0/}
|
||||||
currentVersionReleaseNumber=$(grep "val versionReleaseNumber" ${versionsFile} | cut -d " " -f6)
|
currentVersionReleaseNumber=$(grep "val versionReleaseNumber" ${versionsFile} | cut -d " " -f6)
|
||||||
# if the current month is the same as the current version, we increment the release number, else we reset it to 0
|
# if the release month is the same as the current version, we increment the release number, else we reset it to 0
|
||||||
if [[ ${currentVersionMonth} -eq ${versionMonthCandidateNoLeadingZero} ]]; then
|
if [[ ${currentVersionMonth} -eq ${versionMonthCandidateNoLeadingZero} ]]; then
|
||||||
versionReleaseNumberCandidate=$((currentVersionReleaseNumber + 1))
|
versionReleaseNumberCandidate=$((currentVersionReleaseNumber + 1))
|
||||||
else
|
else
|
||||||
|
|
@ -112,7 +115,7 @@ else
|
||||||
fi
|
fi
|
||||||
versionCandidate="${versionYearCandidate}.${versionMonthCandidate}.${versionReleaseNumberCandidate}"
|
versionCandidate="${versionYearCandidate}.${versionMonthCandidate}.${versionReleaseNumberCandidate}"
|
||||||
|
|
||||||
read -r -p "Please enter the release version (example: ${versionCandidate}). Format must be 'YY.MM.x' or 'YY.MM.xy'. Just press enter if ${versionCandidate} is correct. " version
|
read -r -p "Please enter the release version (example: ${versionCandidate}). Format must be 'YY.MM.x' or 'YY.MM.xy', with year and month matching next Monday. Just press enter if ${versionCandidate} is correct. " version
|
||||||
version=${version:-${versionCandidate}}
|
version=${version:-${versionCandidate}}
|
||||||
|
|
||||||
# extract year, month and release number for future use
|
# extract year, month and release number for future use
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue