From: Abderrahim Kitouni Date: Mon, 9 Oct 2023 16:43:31 +0000 (+0100) Subject: doc-sync: automatically detect whether we're updating the latest version X-Git-Tag: v255-rc1~288^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F29507%2Fhead;p=thirdparty%2Fsystemd.git doc-sync: automatically detect whether we're updating the latest version also update the release instructions to push release candidates to -stable --- diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 817a4d8ec0b..744efcdd705 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -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' diff --git a/tools/sync-docs.py b/tools/sync-docs.py index eab425e718b..edf9767f440 100755 --- a/tools/sync-docs.py +++ b/tools/sync-docs.py @@ -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)