@@ -8,41 +8,34 @@ set -euo pipefail
88
99DOCS_FILE=" docs/install/releases/index.md"
1010
11- # Define unique markdown comments as anchors
1211CALENDAR_START_MARKER=" <!-- RELEASE_CALENDAR_START -->"
1312CALENDAR_END_MARKER=" <!-- RELEASE_CALENDAR_END -->"
1413
15- # Get current date
1614current_date=$( date +" %Y-%m-%d" )
1715current_month=$( date +" %m" )
1816current_year=$( date +" %Y" )
1917
20- # Function to get the first Tuesday of a given month and year
2118get_first_tuesday () {
2219local year=$1
2320local month=$2
2421local first_day
2522local days_until_tuesday
2623local first_tuesday
2724
28- # Find the first day of the month
2925first_day=$( date -d" $year -$month -01" +" %u" )
3026
31- # Calculate days until first Tuesday (if day 1 is Tuesday, first_day=2)
3227days_until_tuesday=$(( first_day== 2 ? 0 : (9 - first_day)% 7 ))
3328
34- # Get the date of the first Tuesday
3529first_tuesday=$( date -d" $year -$month -01 +$days_until_tuesday days" +" %Y-%m-%d" )
3630
3731echo " $first_tuesday "
3832}
3933
40- # Function to format date as "Month DD, YYYY"
34+ # Format date as "Month DD, YYYY"
4135format_date () {
4236date -d" $1 " +" %B %d, %Y"
4337}
4438
45- # Function to get the latest patch version for a minor release
4639get_latest_patch () {
4740local version_major=$1
4841local version_minor=$2
@@ -52,18 +45,33 @@ get_latest_patch() {
5245# Get all tags for this minor version
5346tags=$( cd" $( git rev-parse --show-toplevel) " && git tag| grep" ^v$version_major \\ .$version_minor \\ ." | sort -V)
5447
55- # Get the latest one
5648latest=$( echo" $tags " | tail -1)
5749
5850if [-z " $latest " ]; then
59- # If no tags found, return empty
6051echo " "
6152else
62- # Return without the v prefix
6353echo " ${latest# v} "
6454fi
6555}
6656
57+ get_next_release_month () {
58+ local current_month=$1
59+ local next_month=$(( current_month+ 1 ))
60+
61+ # Handle December -> February transition (skip January)
62+ if [[$next_month -eq 13 ]]; then
63+ next_month=2# Skip to February
64+ return $next_month
65+ fi
66+
67+ # Skip January for all years starting 2025
68+ if [[$next_month -eq 1 ]]; then
69+ next_month=2
70+ fi
71+
72+ return $next_month
73+ }
74+
6775# Generate releases table showing:
6876# - 3 previous unsupported releases
6977# - 1 security support release (n-2)
@@ -84,15 +92,31 @@ generate_release_calendar() {
8492# Start with 3 unsupported releases back
8593start_minor=$(( version_minor- 5 ))
8694
87- # Initialize the calendar table with an additional column for latest release
8895result=" | Release name | Release Date | Status | Latest Release |\n"
8996result+=" |--------------|--------------|--------|----------------|\n"
9097
98+ # Find the latest release month and year
99+ local current_release_minor=$(( version_minor- 1 )) # Current stable release
100+ local tag_date
101+ tag_date=$( cd" $( git rev-parse --show-toplevel) " && git log -1 --format=%ai" v$version_major .$current_release_minor .0" 2> /dev/null|| echo " " )
102+
103+ local current_release_month
104+ local current_release_year
105+
106+ if [-n " $tag_date " ]; then
107+ # Extract month and year from tag date
108+ current_release_month=$( date -d" $tag_date " +" %m" )
109+ current_release_year=$( date -d" $tag_date " +" %Y" )
110+ else
111+ # Default to current month/year if tag not found
112+ current_release_month=$current_month
113+ current_release_year=$current_year
114+ fi
115+
91116# Generate rows for each release (7 total: 3 unsupported, 1 security, 1 stable, 1 mainline, 1 next)
92117for i in {0..6}; do
93118# Calculate release minor version
94119local rel_minor=$(( start_minor+ i))
95- # Format release name without the .x
96120local version_name=" $version_major .$rel_minor "
97121local release_date
98122local formatted_date
@@ -101,22 +125,41 @@ generate_release_calendar() {
101125local status
102126local formatted_version_name
103127
104- # Calculate release month and year based on release pattern
105- # This is a simplified calculation assuming monthly releases
106- local rel_month=$(( (current_month- (5 - i)+ 12 )% 12 ))
107- [[$rel_month -eq 0 ]]&& rel_month=12
108- local rel_year=$current_year
109- if [[$rel_month -gt $current_month ]]; then
110- rel_year=$(( rel_year- 1 ))
111- fi
112- if [[$rel_month -lt $current_month && $i -gt 5 ]]; then
113- rel_year=$(( rel_year+ 1 ))
114- fi
115-
116- # Skip January releases starting from 2025
117- if [[$rel_month -eq 1&& $rel_year -ge 2025 ]]; then
118- rel_month=2
119- # No need to reassign rel_year to itself
128+ # Calculate the release month and year based on the current release's date
129+ # For previous releases, go backward in the release_months array
130+ # For future releases, go forward
131+ local month_offset=$(( i- 4 )) # 4 is the index of the stable release (i=4)
132+
133+ # Start from the current stable release month
134+ local rel_month=$current_release_month
135+ local rel_year=$current_release_year
136+
137+ # Apply the offset to get the target release month
138+ if [$month_offset -lt 0 ]; then
139+ # For previous releases, go backward
140+ for (( j= 0 ; j> month_offset; j-- )) ; do
141+ rel_month=$(( rel_month- 1 ))
142+ if [$rel_month -eq 0 ]; then
143+ rel_month=12
144+ rel_year=$(( rel_year- 1 ))
145+ elif [$rel_month -eq 1 ]; then
146+ # Skip January (go from February to December of previous year)
147+ rel_month=12
148+ rel_year=$(( rel_year- 1 ))
149+ fi
150+ done
151+ elif [$month_offset -gt 0 ]; then
152+ # For future releases, go forward
153+ for (( j= 0 ; j< month_offset; j++ )) ; do
154+ rel_month=$(( rel_month+ 1 ))
155+ if [$rel_month -eq 13 ]; then
156+ rel_month=2# Skip from December to February
157+ rel_year=$(( rel_year+ 1 ))
158+ elif [$rel_month -eq 1 ]; then
159+ # Skip January
160+ rel_month=2
161+ fi
162+ done
120163fi
121164
122165# Get release date (first Tuesday of the month)
@@ -147,7 +190,6 @@ generate_release_calendar() {
147190fi
148191
149192# Format version name and patch link based on release status
150- # No links for unreleased versions
151193if [[" $status " == " Not Released" ]]; then
152194formatted_version_name=" $version_name "
153195patch_link=" N/A"