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
11
11
CALENDAR_START_MARKER=" <!-- RELEASE_CALENDAR_START -->"
12
12
CALENDAR_END_MARKER=" <!-- RELEASE_CALENDAR_END -->"
13
13
14
- current_date=$( date +" %Y-%m-%d" )
15
- current_month=$( date +" %m" )
16
- current_year=$( date +" %Y" )
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
14
# Format date as "Month DD, YYYY"
35
15
format_date () {
36
- date -d " $1 " +" %B %d, %Y"
16
+ TZ=UTC date -d " $1 " +" %B %d, %Y"
37
17
}
38
18
39
19
get_latest_patch () {
@@ -54,22 +34,48 @@ get_latest_patch() {
54
34
fi
55
35
}
56
36
57
- get_next_release_month () {
58
- local current_month=$1
59
- local next_month=$(( current_month + 1 ))
37
+ get_first_patch () {
38
+ local version_major=$1
39
+ local version_minor=$2
40
+ local tags
41
+ local first
42
+
43
+ # Get all tags for this minor version
44
+ tags=$( cd " $( git rev-parse --show-toplevel) " && git tag | grep " ^v$version_major \\ .$version_minor \\ ." | sort -V)
45
+
46
+ first=$( echo " $tags " | head -1)
60
47
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
48
+ if [ -z " $first " ] ; then
49
+ echo " "
50
+ else
51
+ echo " ${first # v} "
65
52
fi
53
+ }
54
+
55
+ get_release_date () {
56
+ local version_major=$1
57
+ local version_minor=$2
58
+ local first_patch
59
+ local tag_date
66
60
67
- # Skip January for all years starting 2025
68
- if [[ $next_month -eq 1 ]]; then
69
- next_month=2
61
+ # Get the first patch release
62
+ first_patch=$( get_first_patch " $version_major " " $version_minor " )
63
+
64
+ if [ -z " $first_patch " ]; then
65
+ # No release found
66
+ echo " "
67
+ return
70
68
fi
71
69
72
- return $next_month
70
+ # Get the tag date from git
71
+ tag_date=$( cd " $( git rev-parse --show-toplevel) " && git log -1 --format=%ai " v$first_patch " 2> /dev/null || echo " " )
72
+
73
+ if [ -z " $tag_date " ]; then
74
+ echo " "
75
+ else
76
+ # Extract date in YYYY-MM-DD format
77
+ TZ=UTC date -d " $tag_date " +" %Y-%m-%d"
78
+ fi
73
79
}
74
80
75
81
# Generate releases table showing:
@@ -95,89 +101,20 @@ generate_release_calendar() {
95
101
result=" | Release name | Release Date | Status | Latest Release |\n"
96
102
result+=" |--------------|--------------|--------|----------------|\n"
97
103
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
104
# Generate rows for each release (7 total: 3 unsupported, 1 security, 1 stable, 1 mainline, 1 next)
117
105
for i in {0..6}; do
118
106
# Calculate release minor version
119
107
local rel_minor=$(( start_minor + i))
120
108
local version_name=" $version_major .$rel_minor "
121
- local release_date
109
+ local actual_release_date
122
110
local formatted_date
123
111
local latest_patch
124
112
local patch_link
125
113
local status
126
114
local formatted_version_name
127
115
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
116
+ # Determine status based on position
117
+ if [[ $i -eq 6 ]]; then
181
118
status=" Not Released"
182
119
elif [[ $i -eq 5 ]]; then
183
120
status=" Mainline"
@@ -189,16 +126,38 @@ generate_release_calendar() {
189
126
status=" Not Supported"
190
127
fi
191
128
129
+ # Get the actual release date from the first published tag
130
+ if [[ " $status " != " Not Released" ]]; then
131
+ actual_release_date=$( get_release_date " $version_major " " $rel_minor " )
132
+
133
+ # Format the release date if we have one
134
+ if [ -n " $actual_release_date " ]; then
135
+ formatted_date=$( format_date " $actual_release_date " )
136
+ else
137
+ # If no release date found, just display TBD
138
+ formatted_date=" TBD"
139
+ fi
140
+ fi
141
+
142
+ # Get latest patch version
143
+ latest_patch=$( get_latest_patch " $version_major " " $rel_minor " )
144
+ if [ -n " $latest_patch " ]; then
145
+ patch_link=" [v${latest_patch} ](https://github.com/coder/coder/releases/tag/v${latest_patch} )"
146
+ else
147
+ patch_link=" N/A"
148
+ fi
149
+
192
150
# Format version name and patch link based on release status
193
151
if [[ " $status " == " Not Released" ]]; then
194
152
formatted_version_name=" $version_name "
195
153
patch_link=" N/A"
154
+ # Add row to table without a date for "Not Released"
155
+ result+=" | $formatted_version_name | | $status | $patch_link |\n"
196
156
else
197
157
formatted_version_name=" [$version_name ](https://coder.com/changelog/coder-$version_major -$rel_minor )"
158
+ # Add row to table with date for released versions
159
+ result+=" | $formatted_version_name | $formatted_date | $status | $patch_link |\n"
198
160
fi
199
-
200
- # Add row to table
201
- result+=" | $formatted_version_name | $formatted_date | $status | $patch_link |\n"
202
161
done
203
162
204
163
echo -e " $result "
0 commit comments