Skip to content

Commit

Permalink
Script the procedure for updating the site for new releases, and upda…
Browse files Browse the repository at this point in the history
…te for 1.5.1
  • Loading branch information
ssorj committed Dec 15, 2023
1 parent 353c538 commit 7e03153
Show file tree
Hide file tree
Showing 9 changed files with 417 additions and 90 deletions.
70 changes: 70 additions & 0 deletions .plano.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

from transom.planocommands import *

import datetime as _datetime

site.output_dir = "docs"

@command
Expand Down Expand Up @@ -125,6 +127,65 @@ def generate_examples(output_file="input/examples/index.html.in"):

write(output_file, "\n".join(out))

@command
def generate_releases(output_file="input/releases/index.md"):
"""
Generate the release index using data from GitHub
"""

_update_release_data()

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

for release in releases["releases"]:
version = release["version"]

if version == latest_release_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)
markdown = read("config/releases.md.in").replace("@releases@", releases)
output_file = get_absolute_path(output_file)

write(output_file, markdown)

def _update_release_data():
releases = http_get_json("https://api.github.com/repos/skupperproject/skupper/releases?per_page=100")
latest_release = http_get_json("https://api.github.com/repos/skupperproject/skupper/releases/latest")

data = dict()

latest_release_tag = latest_release["tag_name"]

data["latest_release"] = {
"version": latest_release_tag,
"url": "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({
"version": release_tag,
"url": f"https://github.com/skupperproject/skupper/releases/tag/{release_tag}",
"date": release["published_at"],
})

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

@command
def test():
render()
Expand All @@ -136,3 +197,12 @@ def test():
run("cat docs/install.sh | sh", shell=True)

generate_docs(output_dir=d)

def parse_timestamp(timestamp, format="%Y-%m-%dT%H:%M:%SZ"):
if timestamp is None:
return None

dt = _datetime.datetime.strptime(timestamp, format)
dt = dt.replace(tzinfo=_datetime.timezone.utc)

return dt
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ The process of publishing these docs to the Skupper website uses

## Updating the site for new Skupper releases

1. Update the `skupper_release` and `skupper_release_date` variables
in `config/config.py`.
2. Add an entry for the previous release to `releases/index.md` in the
"Previous releases" section.
3. Run `plano render --force` to update the site.
Run the `generate-releases` command:

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

This fetches release data from GitHub and updates the site for new
releases.
20 changes: 18 additions & 2 deletions config/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
from plano import *

import datetime as _datetime

def path_nav(page):
links = " <span class=\"path-separator\">&#8250;</span> ".join(list(page.path_nav_links)[1:])
return f"<nav id=\"-path-nav\"><div>{links}</div></nav>"

skupper_release = "1.5.0"
skupper_release_date = "10 November 2023"
def _parse_timestamp(timestamp, format="%Y-%m-%dT%H:%M:%SZ"):
if timestamp is None:
return None

dt = _datetime.datetime.strptime(timestamp, format)
dt = dt.replace(tzinfo=_datetime.timezone.utc)

return dt

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

skupper_release = _latest_release["version"]
skupper_release_date = f"{_latest_release_date.day} {_latest_release_date.strftime('%B %Y')}"
36 changes: 36 additions & 0 deletions config/releases.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Releases
---

# Skupper releases

## The latest release

[Skupper {{skupper_release}}][release-page] was released on {{skupper_release_date}}.

For Linux or the Mac, use the [install script][install-script] to
download and extract the Skupper command:

<pre><code style="font-size: 1.3em;">curl https://skupper.io/install.sh | sh</code></pre>

The script installs the command under your home directory. It prompts
you to add the command to your path if necessary.

For Windows and other installation options, see [Installing
Skupper](/install/index.html).

[release-page]: https://github.com/skupperproject/skupper/releases/tag/{{skupper_release}}
[install-script]: https://github.com/skupperproject/skupper-website/blob/main/docs/install.sh

## Previous releases

<div style="column-count: 3;">

@releases@

</div>

## More resources

* [Skupper releases at GitHub](https://github.com/skupperproject/skupper/releases)
* [Skupper images at Quay.io](https://quay.io/organization/skupper)
199 changes: 199 additions & 0 deletions data/releases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
{
"latest_release": {
"date": "2023-12-06T13:33:03Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/{latest_release_tag}",
"version": "1.5.1"
},
"releases": [
{
"date": "2023-12-06T13:33:03Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.5.1",
"version": "1.5.1"
},
{
"date": "2023-11-15T13:40:57Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.4.4",
"version": "1.4.4"
},
{
"date": "2023-11-10T16:53:30Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.5.0",
"version": "1.5.0"
},
{
"date": "2023-09-20T13:34:04Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.4.3",
"version": "1.4.3"
},
{
"date": "2023-08-29T17:16:50Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.2.8",
"version": "1.2.8"
},
{
"date": "2023-07-19T16:44:39Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.4.2",
"version": "1.4.2"
},
{
"date": "2023-07-05T21:19:06Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.2.7",
"version": "1.2.7"
},
{
"date": "2023-06-21T12:40:46Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.4.1",
"version": "1.4.1"
},
{
"date": "2023-05-04T17:18:00Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.2.6",
"version": "1.2.6"
},
{
"date": "2023-03-27T13:33:24Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.2.5",
"version": "1.2.5"
},
{
"date": "2023-03-10T13:11:11Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.3.0",
"version": "1.3.0"
},
{
"date": "2023-03-09T18:20:04Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.2.4",
"version": "1.2.4"
},
{
"date": "2023-02-08T18:07:43Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.2.3",
"version": "1.2.3"
},
{
"date": "2023-01-18T13:07:26Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.2.2",
"version": "1.2.2"
},
{
"date": "2023-01-11T15:20:31Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.2.1",
"version": "1.2.1"
},
{
"date": "2022-11-14T13:43:16Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.2.0",
"version": "1.2.0"
},
{
"date": "2022-10-07T07:18:35Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.1.1",
"version": "1.1.1"
},
{
"date": "2022-10-03T08:27:46Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.1.0",
"version": "1.1.0"
},
{
"date": "2022-06-14T12:09:52Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.0.2",
"version": "1.0.2"
},
{
"date": "2022-06-02T19:33:18Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.0.1",
"version": "1.0.1"
},
{
"date": "2022-05-10T08:49:42Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/1.0.0",
"version": "1.0.0"
},
{
"date": "2022-03-09T16:43:11Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.8.7",
"version": "0.8.7"
},
{
"date": "2022-02-09T14:03:44Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.8.6",
"version": "0.8.6"
},
{
"date": "2022-01-10T17:47:30Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.8.5",
"version": "0.8.5"
},
{
"date": "2021-12-17T16:49:20Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.8.4",
"version": "0.8.4"
},
{
"date": "2021-11-19T15:54:40Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.8.3",
"version": "0.8.3"
},
{
"date": "2021-11-18T14:22:21Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.8.2",
"version": "0.8.2"
},
{
"date": "2021-11-02T21:28:19Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.8.1",
"version": "0.8.1"
},
{
"date": "2021-10-20T11:58:12Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.8.0",
"version": "0.8.0"
},
{
"date": "2021-07-30T18:43:42Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.7.0",
"version": "0.7.0"
},
{
"date": "2021-05-20T13:54:06Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.6.0",
"version": "0.6.0"
},
{
"date": "2021-04-01T15:18:13Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.5.3",
"version": "0.5.3"
},
{
"date": "2021-03-30T09:28:08Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.5.2",
"version": "0.5.2"
},
{
"date": "2021-03-24T15:35:40Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.5.1",
"version": "0.5.1"
},
{
"date": "2021-03-12T08:57:33Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.5.0",
"version": "0.5.0"
},
{
"date": "2021-01-19T18:00:54Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.4.2",
"version": "0.4.2"
},
{
"date": "2020-12-09T22:19:06Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.4.0",
"version": "0.4.0"
},
{
"date": "2020-07-22T16:55:51Z",
"url": "https://github.com/skupperproject/skupper/releases/tag/0.3.0",
"version": "0.3.0"
}
]
}
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ <h1>Multicloud communication for Kubernetes</h1>
<p><a class="button" id="-popup-video-button"><span class="material-icons">play_circle_filled</span> Watch the video</a></p>
<p><a class="button" href="/docs/index.html"><span class="material-icons">info</span> Learn more</a></p>
<p><a class="button" href="/start/index.html"><span class="material-icons">flag</span> Get started</a></p>
<p><a class="nav" href="/releases/index.html">Get Skupper 1.5.0 <span class="material-icons">chevron_right</span></a></p>
<p><a class="nav" href="/releases/index.html">Get Skupper 1.5.1 <span class="material-icons">chevron_right</span></a></p>
</div>
</div>

Expand Down
Loading

0 comments on commit 7e03153

Please sign in to comment.