Skip to content

Commit 0382eac

Browse files
Use changelogs/release.yaml for the version number source everywhere (#3310)
Co-authored-by: Richard van der Hoff <[email protected]>
1 parent e7e0455 commit 0382eac

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

config.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ privacy_policy = "https://matrix.org/legal/privacy-notice"
4343
# must be one of "unstable", "current", "historical"
4444
# this is used to decide whether to show a banner pointing to the current release
4545
status = "unstable"
46+
# A URL pointing to the latest, stable release of the spec. To be shown in the unstable version warning banner.
4647
current_version_url = "https://matrix.org/docs/spec/"
48+
# The following is used when status = "stable", and is displayed in various UI elements on a released version
49+
# of the spec. CI will set these values here automatically when a release git tag (i.e `v1.5`) is created.
50+
#major = "1"
51+
#minor = "0"
52+
#release_date = "April 01, 2021"
4753

4854
# User interface configuration
4955
[params.ui]

layouts/partials/navbar.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@
4545
{{ $status := .Site.Params.version.status }}
4646

4747
{{ if ne $status "unstable"}}
48-
{{ $ret = .Site.Params.version.number }}
49-
{{ $ret = delimit (slice "version" $ret) " " }}
48+
{{ $path := path.Join "changelogs" }}
49+
50+
{{/* produces a string similar to "version v1.5" */}}
51+
{{ $ret = delimit (slice "version v" .Site.Params.version.major "." .Site.Params.version.minor) "" }}
5052
{{ end }}
5153

5254
{{ return $ret }}

layouts/shortcodes/changelog/changelog-changes.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@
77
it expects to find newsfragments describing changes to that API.
88

99
If the `version.status` setting in config.toml is anything other than
10-
"unstable", then it also expects to find a "release.yaml" file in /changelogs,
11-
which contains:
12-
- `tag`: Git tag for this release
13-
- `date`: date of this release
14-
It then renders this info a table, before the list of changes.
10+
"unstable", then it also expects to find additional settings under
11+
`version` in config.toml:
12+
- `major`: the major version number of the release
13+
- `minor`: the minor version number of the release
14+
- `release_date`: the date of the release
15+
16+
The release tag is calculated as `v<major>.<minor>`; for example `v1.5`.
17+
18+
It then renders this into a table displayed before the list of changes.
1519

1620
*/}}
1721

1822
{{ $path := path.Join "changelogs" }}
1923
{{ $status := .Site.Params.version.status }}
24+
{{ $release_tag := delimit (slice "v" .Site.Params.version.major "." .Site.Params.version.minor) "" }}
2025

2126
{{ if ne $status "unstable" }}
22-
{{ $release_info := readFile (path.Join $path "release.yaml") | transform.Unmarshal }}
2327
<table class="release-info">
24-
<tr><th>Git commit</th><td><a href="https://github.com/matrix-org/matrix-doc/tree/{{ $release_info.tag }}">https://github.com/matrix-org/matrix-doc/tree/{{ $release_info.tag }}</a></td>
25-
<tr><th>Release date</th><td>{{ $release_info.date }}</td>
28+
<tr><th>Git commit</th><td><a href="https://github.com/matrix-org/matrix-doc/tree/{{ $release_tag }}">https://github.com/matrix-org/matrix-doc/tree/{{ $release_tag }}</a></td>
29+
<tr><th>Release date</th><td>{{ .Site.Params.version.release_date }}</td>
2630
</table>
2731
{{ end }}
2832

layouts/shortcodes/changelog/changelog-description.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88
{{ $status := .Site.Params.version.status }}
99

1010
{{ if eq $status "unstable"}}
11+
1112
<p>This is the <strong>unstable</strong> version of the Matrix specification.</p>
1213
<p>This changelog lists changes made since the last release of the specification.</p>
14+
1315
{{ else }}
14-
<p>This is version <strong>{{ .Site.Params.version.number }}</strong> of the Matrix specification.</p>
16+
17+
<p>This is version <strong>v{{ .Site.Params.version.major }}.{{ .Site.Params.version.minor }}</strong> of the Matrix specification.</p>
18+
1519
{{ end }}

0 commit comments

Comments
 (0)