8000 docs: add automatic release calendar updates in docs by matifali · Pull Request #17531 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

docs: add automatic release calendar updates in docs #17531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update release calendar and improve update script
  • Loading branch information
matifali committed Apr 24, 2025
commit 43539a56f9a3b1a46aa033391249a6046a46700b
4 changes: 2 additions & 2 deletions docs/install/releases/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Best practices for installing Coder can be found on our [install](../index.md)
pages.

## Release schedule

<!-- Autogenerated release calendar from scripts/update-release-calendar.sh -->
<!-- RELEASE_CALENDAR_START -->
| Release name | Release Date | Status | Latest Release |
|------------------------------------------------|-------------------|------------------|----------------------------------------------------------------|
Expand All @@ -62,7 +62,7 @@ pages.
| [2.18](https://coder.com/changelog/coder-2-18) | February 04, 2025 | Not Supported | [v2.18.5](https://github.com/coder/coder/releases/tag/v2.18.5) |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [linkspector] reported by reviewdog 🐶
Cannot reach https://coder.com/changelog/coder-2-18 Status: 404

| [2.19](https://coder.com/changelog/coder-2-19) | February 04, 2025 | Security Support | [v2.19.1](https://github.com/coder/coder/releases/tag/v2.19.1) |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [linkspector] reported by reviewdog 🐶
Cannot reach https://coder.com/changelog/coder-2-19 Status: 404

| [2.20](https://coder.com/changelog/coder-2-20) | March 04, 2025 | Stable | [v2.20.2](https://github.com/coder/coder/releases/tag/v2.20.2) |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [linkspector] reported by reviewdog 🐶
Cannot reach https://coder.com/changelog/coder-2-20 Status: 404

| [2.21](https://coder.com/changelog/coder-2-21) | April 01, 2025 | Mainline | [v2.21.0](https://github.com/coder/coder/releases/tag/v2.21.0) |
| [2.21](https://coder.com/changelog/coder-2-21) | April 01, 2025 | Mainline | [v2.21.1](https://github.com/coder/coder/releases/tag/v2.21.1) |
| 2.22 | May 07, 2024 | Not Released | N/A |
<!-- RELEASE_CALENDAR_END -->

Expand Down
58 changes: 36 additions & 22 deletions scripts/update-release-calendar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ current_year=$(date +"%Y")
get_first_tuesday() {
local year=$1
local month=$2
local first_day
local days_until_tuesday
local fir 8000 st_tuesday

# Find the first day of the month
local first_day=$(date -d "$year-$month-01" +"%u")
first_day=$(date -d "$year-$month-01" +"%u")

# Calculate days until first Tuesday (if day 1 is Tuesday, first_day=2)
local days_until_tuesday=$((first_day == 2 ? 0 : (9 - first_day) % 7))
days_until_tuesday=$((first_day == 2 ? 0 : (9 - first_day) % 7))

# Get the date of the first Tuesday
local first_tuesday=$(date -d "$year-$month-01 +$days_until_tuesday days" +"%Y-%m-%d")
first_tuesday=$(date -d "$year-$month-01 +$days_until_tuesday days" +"%Y-%m-%d")

echo "$first_tuesday"
}
Expand All @@ -43,12 +46,14 @@ format_date() {
get_latest_patch() {
local version_major=$1
local version_minor=$2
local tags
local latest

# Get all tags for this minor version
local tags=$(cd "$(git rev-parse --show-toplevel)" && git tag | grep "^v$version_major\\.$version_minor\\." | sort -V)
tags=$(cd "$(git rev-parse --show-toplevel)" && git tag | grep "^v$version_major\\.$version_minor\\." | sort -V)

# Get the latest one
local latest=$(echo "$tags" | tail -1)
latest=$(echo "$tags" | tail -1)

if [ -z "$latest" ]; then
# If no tags found, return empty
Expand All @@ -68,24 +73,33 @@ get_latest_patch() {
generate_release_calendar() {
local result=""
local version_major=2
local latest_version
local version_minor
local start_minor

# Find the current minor version by looking at the last mainline release tag
local latest_version=$(cd "$(git rev-parse --show-toplevel)" && git tag | grep '^v[0-9]*\.[0-9]*\.[0-9]*$' | sort -V | tail -1)
local version_minor=$(echo "$latest_version" | cut -d. -f2)
latest_version=$(cd "$(git rev-parse --show-toplevel)" && git tag | grep '^v[0-9]*\.[0-9]*\.[0-9]*$' | sort -V | tail -1)
version_minor=$(echo "$latest_version" | cut -d. -f2)

# Start with 3 unsupported re 8000 leases back
local start_minor=$((version_minor - 5))
start_minor=$((version_minor - 5))

# Initialize the calendar table with an additional column for latest release
result="| Release name | Release Date | Status | Latest Release |\n"
result+="|-------------|-------------------|------------------|----------------|\n"
result="| Release name | Release Date | Status | Latest Release |\n"
result+="|--------------|--------------|--------|----------------|\n"

# Generate rows for each release (7 total: 3 unsupported, 1 security, 1 stable, 1 mainline, 1 next)
for i in {0..6}; do
# Calculate release minor version
local rel_minor=$((start_minor + i))
# Format release name without the .x
local version_name="$version_major.$rel_minor"
local release_date
local formatted_date
local latest_patch
local patch_link
local status
local formatted_version_name

# Calculate release month and year based on release pattern
# This is a simplified calculation assuming monthly releases
Expand All @@ -102,24 +116,22 @@ generate_release_calendar() {
# Skip January releases starting from 2025
if [[ $rel_month -eq 1 && $rel_year -ge 2025 ]]; then
rel_month=2
rel_year=$rel_year
# No need to reassign rel_year to itself
fi

# Get release date (first Tuesday of the month)
local release_date=$(get_first_tuesday $rel_year $(printf "%02d" $rel_month))
local formatted_date=$(format_date "$release_date")
release_date=$(get_first_tuesday "$rel_year" "$(printf "%02d" "$rel_month")")
formatted_date=$(format_date "$release_date")

# Get latest patch version
local latest_patch=$(get_latest_patch $version_major $rel_minor)
local patch_link=""
latest_patch=$(get_latest_patch "$version_major" "$rel_minor")
if [ -n "$latest_patch" ]; then
patch_link="[v${latest_patch}](https://github.com/coder/coder/releases/tag/v${latest_patch})"
else
patch_link="N/A"
fi

# Determine status
local status
if [[ "$release_date" > "$current_date" ]]; then
status="Not Released"
elif [[ $i -eq 6 ]]; then
Expand All @@ -136,7 +148,6 @@ generate_release_calendar() {

# Format version name and patch link based on release status
# No links for unreleased versions
local formatted_version_name
if [[ "$status" == "Not Released" ]]; then
formatted_version_name="$version_name"
patch_link="N/A"
Expand Down Expand Up @@ -169,14 +180,14 @@ awk -v start_marker="$CALENDAR_START_MARKER" \
-v new_calendar="$NEW_CALENDAR" \
'
BEGIN { found_start = 0; found_end = 0; print_line = 1; }
$0 ~ start_marker {
print;
print new_calendar;
$0 ~ start_marker {
print;
print new_calendar;
found_start = 1;
print_line = 0;
next;
next;
}
$0 ~ end_marker {
$0 ~ end_marker {
found_end = 1;
print_line = 1;
print;
Expand All @@ -188,4 +199,7 @@ awk -v start_marker="$CALENDAR_START_MARKER" \
# Replace the original file with the updated version
mv "${DOCS_FILE}.new" "$DOCS_FILE"

# run make fmt/markdown
make fmt/markdown

echo "Successfully updated release calendar in $DOCS_FILE"
Loading
0