Skip to content

Commit

Permalink
Fix badges
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez committed Sep 9, 2024
1 parent 9abd551 commit 8592768
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
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
| &nbsp;&nbsp;stable2407-4 | ~2024-11-04 | ~2024-11-07 | | Planned |
| &nbsp;&nbsp;stable2407-5 | ~2024-12-02 | ~2024-12-05 | | Planned |
| &nbsp;&nbsp;(5 more) | | | | |
| **stable2409** | &nbsp;&nbsp;2024-09-02 | ~2024-09-25 | ~2025-09-25 | [Drafted](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2409) |
| **stable2409** | &nbsp;&nbsp;2024-09-02 | ~2024-09-25 | ~2025-09-25 | [Staging](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2409-rc1) |
| &nbsp;&nbsp;stable2409-1 | ~2024-10-14 | ~2024-10-17 | | Planned |
| &nbsp;&nbsp;stable2409-2 | ~2024-11-11 | ~2024-11-14 | | Planned |
| &nbsp;&nbsp;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.
6 changes: 3 additions & 3 deletions releases-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@
},
{
"name": "stable2409",
"state": "drafted",
"state": "staging",
"cutoff": {
"when": "2024-09-02",
"tag": "polkadot-stable2409"
"tag": "polkadot-stable2409-rc1"
},
"publish": {
"estimated": "2024-09-25"
Expand Down Expand Up @@ -402,4 +402,4 @@
],
"changelog": "https://github.com/paritytech/polkadot-sdk/releases/tag/$TAG"
}
}
}
2 changes: 1 addition & 1 deletion scripts/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ 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'] = { 'when': date, 'tag': f'polkadot-{version}' }
release['cutoff'] = { 'when': date, 'tag': f'polkadot-{version}-rc1' }
release['state'] = 'drafted'
elif field == 'publish':
release['publish'] = {'when': date, 'tag': f'polkadot-{version}'}
Expand Down
18 changes: 8 additions & 10 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 Down Expand Up @@ -62,17 +64,13 @@ def update_next():
next_release = find_next_unreleased_release(sdk_releases)

if next_release:
next_version = next_release['name'].replace('stable', '')
cutoff_info = next_release['cutoff']
date = format_date(cutoff_info)

formatted_date = format_date(cutoff_info)
# extract the 'stableYYMMDD' part
stable = re.search(r'(stable\d+)', next_release['name']).group(1)

if isinstance(cutoff_info, dict) and 'tag' in cutoff_info:
cutoff_tag = cutoff_info['tag']
else:
cutoff_tag = f"polkadot-{next_release['name']}-cutoff"

next_url = f"https://img.shields.io/badge/Next%20Stable%20Release%20%28{cutoff_tag}%29-{formatted_date}-orange"
next_url = f"https://img.shields.io/badge/Next%20Release-{stable}%20on%20{date}-orange"
next_name = "badges/polkadot-sdk-next.svg"
download(next_url, next_name)
else:
Expand Down

0 comments on commit 8592768

Please sign in to comment.