diff --git a/README.md b/README.md index e3671d3..35261aa 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ This repo contains a [releases-v1.json](./releases-v1.json) file that tracks all |   stable2407-4 | ~2024-11-04 | ~2024-11-07 | | Planned | |   stable2407-5 | ~2024-12-02 | ~2024-12-05 | | Planned | |   (5 more) | | | | | -| **stable2409** |   2024-09-02 | ~2024-09-25 | ~2025-09-25 | Staging | +| **stable2409** |   2024-09-02 | ~2024-09-25 | ~2025-09-25 | [Staging](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2409-rc1) | |   stable2409-1 | ~2024-10-14 | ~2024-10-17 | | Planned | |   stable2409-2 | ~2024-11-11 | ~2024-11-14 | | Planned | |   stable2409-3 | ~2024-12-09 | ~2024-12-12 | | Planned | diff --git a/badges/polkadot-sdk-latest.svg b/badges/polkadot-sdk-latest.svg index c4ea567..d347cd9 100644 --- a/badges/polkadot-sdk-latest.svg +++ b/badges/polkadot-sdk-latest.svg @@ -1 +1 @@ -Current Stable Release: polkadot 2407 2Current Stable Releasepolkadot 2407 2 \ No newline at end of file +Latest Release: stable2407 2Latest Releasestable2407 2 \ No newline at end of file diff --git a/badges/polkadot-sdk-next.svg b/badges/polkadot-sdk-next.svg index 539665d..780a564 100644 --- a/badges/polkadot-sdk-next.svg +++ b/badges/polkadot-sdk-next.svg @@ -1 +1 @@ -Next Stable Release (polkadot 2409): 2024/09/25Next Stable Release (polkadot 2409)2024/09/25 \ No newline at end of file +Next Release (stable2409): 2024/09/25Next Release (stable2409)2024/09/25 \ No newline at end of file diff --git a/releases-v1.json b/releases-v1.json index 25646d5..b18b7bd 100644 --- a/releases-v1.json +++ b/releases-v1.json @@ -8,7 +8,10 @@ { "name": "stable2407", "state": "released", - "cutoff": "2024-04-29", + "cutoff": { + "when": "2024-04-29", + "tag": "polkadot-stable2407" + }, "publish": { "when": "2024-04-29", "tag": "polkadot-stable2407" @@ -118,7 +121,10 @@ { "name": "stable2409", "state": "staging", - "cutoff": "2024-09-02", + "cutoff": { + "when": "2024-09-02", + "tag": "polkadot-stable2409-rc1" + }, "publish": { "estimated": "2024-09-25" }, diff --git a/releases-v1.schema.json b/releases-v1.schema.json index 52955d4..929c462 100644 --- a/releases-v1.schema.json +++ b/releases-v1.schema.json @@ -72,10 +72,10 @@ "description": "The kind of release" }, "cutoff": { - "$ref": "#/definitions/dateOrEstimated" + "$ref": "#/definitions/dateAndTag" }, "publish": { - "$ref": "#/definitions/publishInfo" + "$ref": "#/definitions/dateAndTag" }, "endOfLife": { "$ref": "#/definitions/dateOrEstimated" @@ -110,7 +110,7 @@ "$ref": "#/definitions/dateOrEstimated" }, "publish": { - "$ref": "#/definitions/publishInfo" + "$ref": "#/definitions/dateAndTag" }, "state": { "$ref": "#/definitions/maintainedState" @@ -146,7 +146,7 @@ } ] }, - "publishInfo": { + "dateAndTag": { "oneOf": [ { "type": "object", @@ -163,7 +163,8 @@ "required": [ "when", "tag" - ] + ], + "additionalProperties": false }, { "type": "object", @@ -176,7 +177,8 @@ "required": [ "estimated" ], - "description": "The estimated date for publishing the release" + "description": "The estimated date for publishing the release", + "additionalProperties": false } ] }, diff --git a/scripts/manage.py b/scripts/manage.py index ffb6f66..57172c3 100644 --- a/scripts/manage.py +++ b/scripts/manage.py @@ -133,8 +133,8 @@ def update_release(data, version, date, field): return update_patch(release, version.split('-')[1], date, field) else: # It's a release if field == 'cutoff': - release['cutoff'] = date - release['state'] = 'testing' + release['cutoff'] = { 'when': date, 'tag': f'polkadot-{version}-rc1' } + release['state'] = 'drafted' elif field == 'publish': release['publish'] = {'when': date, 'tag': f'polkadot-{version}'} release['state'] = 'released' diff --git a/scripts/update-badges.py b/scripts/update-badges.py index d11b1ae..876efa4 100644 --- a/scripts/update-badges.py +++ b/scripts/update-badges.py @@ -10,11 +10,13 @@ import json import os import requests +import re from datetime import datetime releases = json.load(open("releases-v1.json")) def download(url, filename): + print(f"Downloading {url}") response = requests.get(url) if response.status_code == 200: @@ -27,11 +29,11 @@ def download(url, filename): def update_latest(): recommended = releases["Polkadot SDK"]["recommended"] - latest = recommended['release'].replace('stable', '') + latest = recommended['release'] if 'patch' in recommended: latest += f"_{recommended['patch']}" - latest_url = f"https://img.shields.io/badge/Current%20Stable%20Release-polkadot_{latest}-green" + latest_url = f"https://img.shields.io/badge/Latest%20Release-{latest}-green" latest_name = "badges/polkadot-sdk-latest.svg" download(latest_url, latest_name) @@ -41,7 +43,17 @@ def find_next_unreleased_release(releases): return release return None -def format_date(date_str): +def format_date(date_info): + if isinstance(date_info, dict): + if 'estimated' in date_info: + date_str = date_info['estimated'] + elif 'when' in date_info: + date_str = date_info['when'] + else: + return "Unknown" + else: + date_str = date_info + date_obj = datetime.strptime(date_str, "%Y-%m-%d") return date_obj.strftime("%Y/%m/%d") @@ -52,17 +64,13 @@ def update_next(): next_release = find_next_unreleased_release(sdk_releases) if next_release: - next_version = next_release['name'].replace('stable', '') - publish_date = next_release['publish'] + publish_info = next_release['publish'] + date = format_date(publish_info) - if isinstance(publish_date, dict) and 'estimated' in publish_date: - formatted_date = format_date(publish_date['estimated']) - elif isinstance(publish_date, dict) and 'when' in publish_date: - formatted_date = format_date(publish_date['when']) - else: - formatted_date = "Unknown" + # extract the 'stableYYMMDD' part + stable = re.search(r'(stable\d+)', next_release['name']).group(1) - next_url = f"https://img.shields.io/badge/Next%20Stable%20Release%20%28polkadot_{next_version}%29-{formatted_date}-orange" + next_url = f"https://img.shields.io/badge/Next%20Release%20%28{stable}%29-{date}-orange" next_name = "badges/polkadot-sdk-next.svg" download(next_url, next_name) else: diff --git a/scripts/update-calendar.py b/scripts/update-calendar.py index 52b7026..f615f87 100644 --- a/scripts/update-calendar.py +++ b/scripts/update-calendar.py @@ -16,6 +16,8 @@ def parse_date(date_str): return datetime.strptime(date_str, "%Y-%m-%d").date() elif isinstance(date_str, dict) and 'estimated' in date_str: return datetime.strptime(date_str['estimated'], "%Y-%m-%d").date() + elif isinstance(date_str, dict) and 'when' in date_str: + return datetime.strptime(date_str['when'], "%Y-%m-%d").date() return None def create_event(name, start_date, end_date=None, description=""): diff --git a/scripts/update-readme.py b/scripts/update-readme.py index 55b2ed5..4f85c0e 100644 --- a/scripts/update-readme.py +++ b/scripts/update-readme.py @@ -26,9 +26,15 @@ def format_state(state: Any) -> str: return f"Deprecated" return 'N/A' -def link_to_changelog(name: str, publish: Any, is_deprecated: bool) -> str: +def link_to_changelog(name: str, publish: Any, cutoff: Any, is_deprecated: bool) -> str: + tag = None if isinstance(publish, dict) and 'tag' in publish: - name_with_link = f"[{name}](https://github.com/paritytech/polkadot-sdk/releases/tag/{publish['tag']})" + tag = publish['tag'] + elif isinstance(cutoff, dict) and 'tag' in cutoff: + tag = cutoff['tag'] + + if tag: + name_with_link = f"[{name}](https://github.com/paritytech/polkadot-sdk/releases/tag/{tag})" else: name_with_link = name @@ -36,7 +42,7 @@ def link_to_changelog(name: str, publish: Any, is_deprecated: bool) -> str: def generate_row(item: Dict[str, Any], is_patch: bool = False, is_recommended: bool = False, is_planned: bool = False) -> str: state = format_state(item['state']) - state = link_to_changelog(state, item['publish'], state.lower() == 'deprecated') + state = link_to_changelog(state, item['publish'], item['cutoff'], state.lower() == 'deprecated') is_deprecated = isinstance(item['state'], str) and item['state'].lower() == 'deprecated' name = f"{'  ' if is_patch else ''}{item['name']}" cutoff = format_date(item['cutoff'])