From e8868e83544d8cc635518fc4f73325ccc0c3fa31 Mon Sep 17 00:00:00 2001 From: Abderrahim Kitouni Date: Mon, 9 Oct 2023 20:28:27 +0100 Subject: [PATCH] doc-sync: add support for uploading the documentation for main It will refuse running on any other branch than main or stable branches. Also update the release instructions to run it on the stable branch. --- docs/RELEASE.md | 12 ++++++------ tools/sync-docs.py | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 744efcdd70..0fa86eda1f 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -18,11 +18,11 @@ SPDX-License-Identifier: LGPL-2.1-or-later 9. Tag the release: `version=vXXX-rcY && git tag -s "${version}" -m "systemd ${version}"` 10. Do `ninja -C build` 11. Make sure that the version string and package string match: `build/systemctl --version` -12. Upload the documentation: `ninja -C build doc-sync` -13. [FINAL] Close the github milestone and open a new one (https://github.com/systemd/systemd/milestones) -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. Push commits to stable, create an empty -stable branch: `git push systemd-stable --atomic origin/main:main origin/main:refs/heads/${version}-stable`. +12. [FINAL] Close the github milestone and open a new one (https://github.com/systemd/systemd/milestones) +13. "Draft" a new release on github (https://github.com/systemd/systemd/releases/new), mark "This is a pre-release" if appropriate. +14. Check that announcement to systemd-devel, with a copy&paste from NEWS, was sent. This should happen automatically. +15. Update IRC topic (`/msg chanserv TOPIC #systemd Version NNN released`) +16. Push commits to stable, create an empty -stable branch: `git push systemd-stable --atomic origin/main:main origin/main:refs/heads/${version}-stable`. +17. Build and upload the documentation (on the -stable branch): `ninja -C build doc-sync` 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 edf9767f44..95436e2710 100755 --- a/tools/sync-docs.py +++ b/tools/sync-docs.py @@ -95,19 +95,27 @@ def main(version, directory, www_target): index_filename = os.path.join(directory, "index.json") nav_filename = os.path.join(directory, "nav.js") + current_branch = subprocess.check_output(["git", "branch", "--show-current"], text=True).strip() + + if current_branch != 'main' and not current_branch.endswith("-stable"): + sys.exit("doc-sync should only be run from main or a stable branch") + for filename in glob.glob(os.path.join(directory, "*.html")): process_file(filename) + if current_branch == "main": + version = "devel" + dirs = ["devel"] + elif int(version) == get_latest_version(): + dirs = [version, "latest"] + else: + dirs = [version] + with open(nav_filename, "w") as f: f.write(NAV_JS) update_index_file(version, index_filename) - dirs = [version] - - if int(version) == get_latest_version(): - dirs.append("latest") - for d in dirs: subprocess.check_call( [