Skip to content

Commit

Permalink
Refactor the release json a bit and put it in a published location
Browse files Browse the repository at this point in the history
  • Loading branch information
ssorj committed Dec 18, 2023
1 parent 7e03153 commit 85c5877
Show file tree
Hide file tree
Showing 6 changed files with 412 additions and 219 deletions.
30 changes: 15 additions & 15 deletions .plano.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,21 @@ def generate_releases(output_file="input/releases/index.md"):

_update_release_data()

releases = read_json("data/releases.json")
latest_release_version = releases["latest_release"]["version"]
releases = read_json("input/data/releases.json")
latest_version = releases["latest"]["version"]
out = list()

for release in releases["releases"]:
def sort(release):
return parse_timestamp(release["date"])

for release in sorted(releases.values(), key=sort, reverse=True):
version = release["version"]
url = release["github_url"]
date = parse_timestamp(release["date"])

if version == latest_release_version:
if version == latest_version:
continue

url = release["url"]
date = parse_timestamp(release["date"])

out.append(f"* [{version}]({url}) - {date.day} {date.strftime('%B %Y')}")

releases = "\n".join(out)
Expand All @@ -164,27 +166,25 @@ def _update_release_data():

latest_release_tag = latest_release["tag_name"]

data["latest_release"] = {
data["latest"] = {
"version": latest_release_tag,
"url": "https://github.com/skupperproject/skupper/releases/tag/{latest_release_tag}",
"github_url": f"https://github.com/skupperproject/skupper/releases/tag/{latest_release_tag}",
"date": latest_release["published_at"],
}

data["releases"] = list()

for release in releases:
if release["prerelease"] or release["draft"]:
continue

release_tag = release["tag_name"]

data["releases"].append({
data[release_tag] = {
"version": release_tag,
"url": f"https://github.com/skupperproject/skupper/releases/tag/{release_tag}",
"github_url": f"https://github.com/skupperproject/skupper/releases/tag/{release_tag}",
"date": release["published_at"],
})
}

write_json("data/releases.json", data)
write_json("input/data/releases.json", data)

@command
def test():
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ The process of publishing these docs to the Skupper website uses

## Updating the site for new Skupper releases

Run the `generate-releases` command:
The `generate-releases` command fetches release data from GitHub and
updates the site for new releases.

~~~ console
./plano generate-releases
./plano render --force
~~~

This fetches release data from GitHub and updates the site for new
releases.
2 changes: 1 addition & 1 deletion config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def _parse_timestamp(timestamp, format="%Y-%m-%dT%H:%M:%SZ"):

return dt

_latest_release = read_json("data/releases.json")["latest_release"]
_latest_release = read_json("input/data/releases.json")["latest"]
_latest_release_date = _parse_timestamp(_latest_release["date"])

skupper_release = _latest_release["version"]
Expand Down
199 changes: 0 additions & 199 deletions data/releases.json

This file was deleted.

Loading

0 comments on commit 85c5877

Please sign in to comment.