From a103ff95235b48c11e7905255bc5e1f4813b2f57 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Fri, 9 Oct 2020 06:00:39 -0700 Subject: [PATCH] [website] new command `make new-website-version` Summary: This can be used to push a new version of the website when publishing a new version of infer. Reviewed By: martintrojer Differential Revision: D24193377 fbshipit-source-id: d2f357558 --- Makefile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Makefile b/Makefile index 56d02f6db..b13a6f754 100644 --- a/Makefile +++ b/Makefile @@ -926,6 +926,29 @@ endif $(QUIET)$(call silent_on_success,Calling 'infer help --write-website',\ $(INFER_BIN) help --write-website "$(WEBSITE_DIR)") +.PHONY: new-website-version +new-website-version: doc-publish +# this will version docs/ appropriately + cd $(WEBSITE_DIR) && \ + yarn run docusaurus docs:version $(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH) +# copy static versioned resources + cd $(WEBSITE_DIR)/static/man && \ + cp -a next/ $(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ + cd $(WEBSITE_DIR)/static/odoc && \ + cp -a next/ $(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ +# adjust intra-doc paths in new doc version + cd $(WEBSITE_DIR)/versioned_docs/version-$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ && \ + find . -type f -not -name versions.md \ + -exec sed -i -e 's#/docs/next/#/docs/#g' \{\} \+ +# adjust paths to static versioned resources in new doc version + cd $(WEBSITE_DIR)/versioned_docs/version-$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ && \ + find . -type f -not -name versions.md \ + -exec sed -i -e 's#/next/#/$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/#g' \{\} \+ +# adjust versions.md, the page where users can navigate to other versions of the docs + cd $(WEBSITE_DIR)/ && \ + find docs versioned_docs -name versions.md \ + -exec sed -i -e 's#^- \[latest released version (\([^)]*\))\](/docs/getting-started)$$#- [latest released version ($(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH))](/docs/getting-started)\n- [previous version (\1)](/docs/\1/getting-started)#' \{\} \+ + # print list of targets .PHONY: show-targets show-targets: