3
3
set -euo pipefail
4
4
5
5
# This script automatically updates the release calendar in docs/install/releases/index.md
6
- # It calculates the releases based on the first Tuesday of each month rule
7
- # and updates the status of each release (Not Supported, Security Support, Stable, Mainline, Not Released)
6
+ # It updates the status of each release (Not Supported, Security Support, Stable, Mainline, Not Released)
7
+ # and gets the release dates from the first published tag for each minor release.
8
8
9
9
DOCS_FILE=" docs/install/releases/index.md"
10
10
@@ -15,22 +15,6 @@ current_date=$(date +"%Y-%m-%d")
15
15
current_month=$( date +" %m" )
16
16
current_year=$( date +" %Y" )
17
17
18
- get_first_tuesday () {
19
- local year=$1
20
- local month=$2
21
- local first_day
22
- local days_until_tuesday
23
- local first_tuesday
24
-
25
- first_day=$( date -d " $year -$month -01" +" %u" )
26
-
27
- days_until_tuesday=$(( first_day == 2 ? 0 : (9 - first_day) % 7 ))
28
-
29
- first_tuesday=$( date -d " $year -$month -01 +$days_until_tuesday days" +" %Y-%m-%d" )
30
-
31
- echo " $first_tuesday "
32
- }
33
-
34
18
# Format date as "Month DD, YYYY"
35
19
format_date () {
36
20
date -d " $1 " +" %B %d, %Y"
@@ -54,22 +38,48 @@ get_latest_patch() {
54
38
fi
55
39
}
56
40
57
- get_next_release_month () {
58
- local current_month=$1
59
- local next_month=$(( current_month + 1 ))
41
+ get_first_patch () {
42
+ local version_major=$1
43
+ local version_minor=$2
44
+ local tags
45
+ local first
46
+
47
+ # Get all tags for this minor version
48
+ tags=$( cd " $( git rev-parse --show-toplevel) " && git tag | grep " ^v$version_major \\ .$version_minor \\ ." | sort -V)
60
49
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
50
+ first=$( echo " $tags " | head -1)
66
51
67
- # Skip January for all years starting 2025
68
- if [[ $next_month -eq 1 ]]; then
69
- next_month=2
52
+ if [ -z " $first " ]; then
53
+ echo " "
54
+ else
55
+ echo " ${first# v} "
70
56
fi
57
+ }
71
58
72
- return $next_month
59
+ get_release_date () {
60
+ local version_major=$1
61
+ local version_minor=$2
62
+ local first_patch
63
+ local tag_date
64
+
65
+ # Get the first patch release
66
+ first_patch=$( get_first_patch " $version_major " " $version_minor " )
67
+
68
+ if [ -z " $first_patch " ]; then
69
+ # No release found
70
+ echo " "
71
+ return
72
+ fi
73
+
74
+ # Get the tag date from git
75
+ tag_date=$( cd " $( git rev-parse --show-toplevel) " && git log -1 --format=%ai " v$first_patch " 2> /dev/null || echo " " )
76
+
77
+ if [ -z " $tag_date " ]; then
78
+ echo " "
79
+ else
80
+ # Extract date in YYYY-MM-DD format
81
+ date -d " $tag_date " +" %Y-%m-%d"
82
+ fi
73
83
}
74
84
75
85
# Generate releases table showing:
@@ -95,89 +105,20 @@ generate_release_calendar() {
95
105
result=" | Release name | Release Date | Status | Latest Release |\n"
96
106
result+=" |--------------|--------------|--------|----------------|\n"
97
107
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
-
116
108
# Generate rows for each release (7 total: 3 unsupported, 1 security, 1 stable, 1 mainline, 1 next)
117
109
for i in {0..6}; do
118
110
# Calculate release minor version
119
111
local rel_minor=$(( start_minor + i))
120
112
local version_name=" $version_major .$rel_minor "
121
- local release_date
113
+ local actual_release_date
122
114
local formatted_date
123
115
local latest_patch
124
116
local patch_link
125
117
local status
126
118
local formatted_version_name
127
119
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
163
- fi
164
-
165
- # Get release date (first Tuesday of the month)
166
- release_date=$( get_first_tuesday " $rel_year " " $( printf " %02d" " $rel_month " ) " )
167
- formatted_date=$( format_date " $release_date " )
168
-
169
- # Get latest patch version
170
- latest_patch=$( get_latest_patch " $version_major " " $rel_minor " )
171
- if [ -n " $latest_patch " ]; then
172
- patch_link=" [v${latest_patch} ](https://github.com/coder/coder/releases/tag/v${latest_patch} )"
173
- else
174
- patch_link=" N/A"
175
- fi
176
-
177
- # Determine status
178
- if [[ " $release_date " > " $current_date " ]]; then
179
- status=" Not Released"
180
- elif [[ $i -eq 6 ]]; then
120
+ # Determine status based on position
121
+ if [[ $i -eq 6 ]]; then
181
122
status=" Not Released"
182
123
elif [[ $i -eq 5 ]]; then
183
124
status=" Mainline"
@@ -189,16 +130,38 @@ generate_release_calendar() {
189
130
status=" Not Supported"
190
131
fi
191
132
133
+ # Get the actual release date from the first published tag
134
+ if [[ " $status " != " Not Released" ]]; then
135
+ actual_release_date=$( get_release_date " $version_major " " $rel_minor " )
136
+
137
+ # Format the release date if we have one
138
+ if [ -n " $actual_release_date " ]; then
139
+ formatted_date=$( format_date " $actual_release_date " )
140
+ else
141
+ # If no release date found, just display TBD
142
+ formatted_date=" TBD"
143
+ fi
144
+ fi
145
+
146
+ # Get latest patch version
147
+ latest_patch=$( get_latest_patch " $version_major " " $rel_minor " )
148
+ if [ -n " $latest_patch " ]; then
149
+ patch_link=" [v${latest_patch} ](https://github.com/coder/coder/releases/tag/v${latest_patch} )"
150
+ else
151
+ patch_link=" N/A"
152
+ fi
153
+
192
154
# Format version name and patch link based on release status
193
155
if [[ " $status " == " Not Released" ]]; then
194
156
formatted_version_name=" $version_name "
195
157
patch_link=" N/A"
158
+ # Add row to table without a date for "Not Released"
159
+ result+=" | $formatted_version_name | | $status | $patch_link |\n"
196
160
else
197
161
formatted_version_name=" [$version_name ](https://coder.com/changelog/coder-$version_major -$rel_minor )"
162
+ # Add row to table with date for released versions
163
+ result+=" | $formatted_version_name | $formatted_date | $status | $patch_link |\n"
198
164
fi
199
-
200
- # Add row to table
201
- result+=" | $formatted_version_name | $formatted_date | $status | $patch_link |\n"
202
165
done
203
166
204
167
echo -e " $result "
@@ -244,4 +207,4 @@ mv "${DOCS_FILE}.new" "$DOCS_FILE"
244
207
# run make fmt/markdown
245
208
make fmt/markdown
246
209
247
- echo " Successfully updated release calendar in $DOCS_FILE "
210
+ echo " Successfully updated release calendar in $DOCS_FILE "
0 commit comments