]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
doc-sync: automatically detect whether we're updating the latest version 29507/head
authorAbderrahim Kitouni <abderrahim.kitouni@codethink.co.uk>
Mon, 9 Oct 2023 16:43:31 +0000 (17:43 +0100)
committerAbderrahim Kitouni <abderrahim.kitouni@codethink.co.uk>
Mon, 9 Oct 2023 17:37:41 +0000 (18:37 +0100)
also update the release instructions to push release candidates to -stable

docs/RELEASE.md
tools/sync-docs.py

index 817a4d8ec0bf98f6a7a4501a2d6cc632cf83ea27..744efcdd705db3153adb0d27e81e245aa5ad9a23 100644 (file)
@@ -23,5 +23,6 @@ SPDX-License-Identifier: LGPL-2.1-or-later
 14. "Draft" a new release on github (https://github.com/systemd/systemd/releases/new), mark "This is a pre-release" if appropriate.
 15. Check that announcement to systemd-devel, with a copy&paste from NEWS, was sent. This should happen automatically.
 16. Update IRC topic (`/msg chanserv TOPIC #systemd Version NNN released`)
-17. [FINAL] Push commits to stable, create an empty -stable branch: `git push systemd-stable --atomic origin/main:main origin/main:refs/heads/${version}-stable`, and change the default branch to latest release (https://github.com/systemd/systemd-stable/settings/branches).
-18. [FINAL] Change the Github Pages branch in the stable repository to the newly created branch (https://github.com/systemd/systemd-stable/settings/pages) and set the 'Custom domain' to 'systemd.io'
+17. Push commits to stable, create an empty -stable branch: `git push systemd-stable --atomic origin/main:main origin/main:refs/heads/${version}-stable`.
+18. [FINAL] Change the default branch to latest release (https://github.com/systemd/systemd-stable/settings/branches).
+19. [FINAL] Change the Github Pages branch in the stable repository to the newly created branch (https://github.com/systemd/systemd-stable/settings/pages) and set the 'Custom domain' to 'systemd.io'
index eab425e718bc86a355c5bb81a6086f3688b5b89e..edf9767f44032a10e02104a468b664114e9e799b 100755 (executable)
@@ -81,7 +81,17 @@ def update_index_file(version, index_filename):
         json.dump(index, f)
 
 
-def main(version, directory, www_target, latest):
+def get_latest_version():
+    tags = subprocess.check_output(["git", "tag", "-l", "v*"], text=True).split()
+    versions = []
+    for tag in tags:
+        m = re.match("v?(\d+).*", tag)
+        if m:
+            versions.append(int(m.group(1)))
+    return max(versions)
+
+
+def main(version, directory, www_target):
     index_filename = os.path.join(directory, "index.json")
     nav_filename = os.path.join(directory, "nav.js")
 
@@ -95,7 +105,7 @@ def main(version, directory, www_target, latest):
 
     dirs = [version]
 
-    if latest:
+    if int(version) == get_latest_version():
         dirs.append("latest")
 
     for d in dirs:
@@ -126,9 +136,8 @@ def main(version, directory, www_target, latest):
 if __name__ == "__main__":
     parser = ArgumentParser()
     parser.add_argument("--version", required=True)
-    parser.add_argument("--no-latest", dest="latest", action="store_false")
     parser.add_argument("directory")
     parser.add_argument("www_target")
 
     args = parser.parse_args()
-    main(args.version, args.directory, args.www_target, args.latest)
+    main(args.version, args.directory, args.www_target)