Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit170f41a

Browse files
authored
chore: fix release calendar and script (#17745)
Updates the script for the release calendar to use the actual releasedates.This is done to work around the anomaly of the delayed May release.
1 parentef745c0 commit170f41a

File tree

2 files changed

+71
-112
lines changed

2 files changed

+71
-112
lines changed

‎docs/install/releases/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ pages.
5858
| Release name| Release Date| Status| Latest Release|
5959
|------------------------------------------------|-------------------|------------------|----------------------------------------------------------------|
6060
|[2.16](https://coder.com/changelog/coder-2-16)| October 01, 2024| Not Supported|[v2.16.1](https://github.com/coder/coder/releases/tag/v2.16.1)|
61-
|[2.17](https://coder.com/changelog/coder-2-17)| November05, 2024| Not Supported|[v2.17.3](https://github.com/coder/coder/releases/tag/v2.17.3)|
61+
|[2.17](https://coder.com/changelog/coder-2-17)| November04, 2024| Not Supported|[v2.17.3](https://github.com/coder/coder/releases/tag/v2.17.3)|
6262
|[2.18](https://coder.com/changelog/coder-2-18)| December 03, 2024| Not Supported|[v2.18.5](https://github.com/coder/coder/releases/tag/v2.18.5)|
6363
|[2.19](https://coder.com/changelog/coder-2-19)| February 04, 2025| Security Support|[v2.19.3](https://github.com/coder/coder/releases/tag/v2.19.3)|
6464
|[2.20](https://coder.com/changelog/coder-2-20)| March 04, 2025| Stable|[v2.20.3](https://github.com/coder/coder/releases/tag/v2.20.3)|
65-
|[2.21](https://coder.com/changelog/coder-2-21)| April01, 2025| Mainline|[v2.21.3](https://github.com/coder/coder/releases/tag/v2.21.3)|
66-
| 2.22|May 06, 2025| Not Released| N/A|
65+
|[2.21](https://coder.com/changelog/coder-2-21)| April02, 2025| Mainline|[v2.21.3](https://github.com/coder/coder/releases/tag/v2.21.3)|
66+
| 2.22|| Not Released| N/A|
6767
<!-- RELEASE_CALENDAR_END-->
6868

6969
>[!TIP]

‎scripts/update-release-calendar.sh

Lines changed: 68 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,17 @@
33
set -euo pipefail
44

55
# This script automatically updates the release calendar in docs/install/releases/index.md
6-
# Itcalculates thereleases based on the first Tuesday of each month rule
7-
# andupdates thestatus of each release (Not Supported, Security Support, Stable, Mainline, Not Released)
6+
# Itupdates thestatus of each release (Not Supported, Security Support, Stable, Mainline, Not Released)
7+
# andgets therelease dates from the first published tag for each minor release.
88

99
DOCS_FILE="docs/install/releases/index.md"
1010

1111
CALENDAR_START_MARKER="<!-- RELEASE_CALENDAR_START -->"
1212
CALENDAR_END_MARKER="<!-- RELEASE_CALENDAR_END -->"
1313

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-
3414
# Format date as "Month DD, YYYY"
3515
format_date() {
36-
date -d"$1" +"%B %d, %Y"
16+
TZ=UTCdate -d"$1" +"%B %d, %Y"
3717
}
3818

3919
get_latest_patch() {
@@ -54,22 +34,48 @@ get_latest_patch() {
5434
fi
5535
}
5636

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)
6047

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}"
6552
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
6660

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
7068
fi
7169

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
7379
}
7480

7581
# Generate releases table showing:
@@ -95,89 +101,20 @@ generate_release_calendar() {
95101
result="| Release name | Release Date | Status | Latest Release |\n"
96102
result+="|--------------|--------------|--------|----------------|\n"
97103

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-
116104
# Generate rows for each release (7 total: 3 unsupported, 1 security, 1 stable, 1 mainline, 1 next)
117105
foriin {0..6};do
118106
# Calculate release minor version
119107
local rel_minor=$((start_minor+ i))
120108
local version_name="$version_major.$rel_minor"
121-
localrelease_date
109+
localactual_release_date
122110
local formatted_date
123111
local latest_patch
124112
local patch_link
125113
local status
126114
local formatted_version_name
127115

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
181118
status="Not Released"
182119
elif [[$i-eq 5 ]];then
183120
status="Mainline"
@@ -189,16 +126,38 @@ generate_release_calendar() {
189126
status="Not Supported"
190127
fi
191128

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+
192150
# Format version name and patch link based on release status
193151
if [["$status"=="Not Released" ]];then
194152
formatted_version_name="$version_name"
195153
patch_link="N/A"
154+
# Add row to table without a date for "Not Released"
155+
result+="|$formatted_version_name | |$status |$patch_link |\n"
196156
else
197157
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"
198160
fi
199-
200-
# Add row to table
201-
result+="|$formatted_version_name |$formatted_date |$status |$patch_link |\n"
202161
done
203162

204163
echo -e"$result"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp