Skip to content
New issue

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

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

Already on GitHub? # to your account

Include tags into release cutoff info #11

Merged
merged 7 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion badges/polkadot-sdk-latest.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion badges/polkadot-sdk-next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions releases-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
},
Expand Down
14 changes: 8 additions & 6 deletions releases-v1.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -110,7 +110,7 @@
"$ref": "#/definitions/dateOrEstimated"
},
"publish": {
"$ref": "#/definitions/publishInfo"
"$ref": "#/definitions/dateAndTag"
},
"state": {
"$ref": "#/definitions/maintainedState"
Expand Down Expand Up @@ -146,7 +146,7 @@
}
]
},
"publishInfo": {
"dateAndTag": {
"oneOf": [
{
"type": "object",
Expand All @@ -163,7 +163,8 @@
"required": [
"when",
"tag"
]
],
"additionalProperties": false
},
{
"type": "object",
Expand All @@ -176,7 +177,8 @@
"required": [
"estimated"
],
"description": "The estimated date for publishing the release"
"description": "The estimated date for publishing the release",
"additionalProperties": false
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions scripts/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
32 changes: 20 additions & 12 deletions scripts/update-badges.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand All @@ -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")

Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions scripts/update-calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=""):
Expand Down
12 changes: 9 additions & 3 deletions scripts/update-readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@ 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

return f"~~{name_with_link}~~" if is_deprecated else name_with_link

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'])
Expand Down
Loading