From 739d0da4e3bc30c0acdaa2459f3df9d248bdd78f Mon Sep 17 00:00:00 2001 From: xffxff <1247714429@qq.com> Date: Mon, 19 Jun 2023 16:08:53 +0800 Subject: [PATCH 1/3] add a link to the old version of Salsa in the document --- book/src/caveat.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/book/src/caveat.md b/book/src/caveat.md index bc3a4607..b48ed3e8 100644 --- a/book/src/caveat.md +++ b/book/src/caveat.md @@ -1,3 +1,5 @@ > ⚠️ **IN-PROGRESS VERSION OF SALSA.** ⚠️ > > This page describes the unreleased "Salsa 2022" version, which is a major departure from older versions of salsa. The code here works but is only available on github and from the `salsa-2022` crate. +> +> If you are looking for the older version of salsa, simply visit [this link](https://old-salsa-rs.netlify.app/) From c3a979f72c569484d299a5bd48bfe9b1eb7ebb56 Mon Sep 17 00:00:00 2001 From: XFFXFF <1247714429@qq.com> Date: Sun, 29 Oct 2023 10:00:59 +0800 Subject: [PATCH 2/3] deploy both the latest and specified older version of salsa book --- book/_redirects | 2 ++ book/netlify.sh | 32 +++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 book/_redirects diff --git a/book/_redirects b/book/_redirects new file mode 100644 index 00000000..3db10678 --- /dev/null +++ b/book/_redirects @@ -0,0 +1,2 @@ +# Redirects from what the browser requests to what we serve +/ /salsa2022 \ No newline at end of file diff --git a/book/netlify.sh b/book/netlify.sh index aad6c9d7..7f6c3f26 100755 --- a/book/netlify.sh +++ b/book/netlify.sh @@ -13,4 +13,34 @@ curl -L https://github.com/badboy/mdbook-mermaid/releases/download/v$MDBOOK_MERM curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v$MDBOOK_LINKCHECK_VERSION/mdbook-linkcheck.v$MDBOOK_LINKCHECK_VERSION.x86_64-unknown-linux-gnu.zip -O unzip mdbook-linkcheck.v$MDBOOK_LINKCHECK_VERSION.x86_64-unknown-linux-gnu.zip -d ~/.cargo/bin chmod +x ~/.cargo/bin/mdbook-linkcheck -mdbook build \ No newline at end of file + +# ====================================================================== +# The following script automates the deployment of both the latest and a +# specified older version of the 'salsa' documentation using mdbook + +# Store the current branch or commit +original_branch=$(git rev-parse --abbrev-ref HEAD) +if [ "$original_branch" == "HEAD" ]; then + original_branch=$(git rev-parse HEAD) +fi + +mkdir -p versions # Create a root directory for all versions + +# Declare an associative array to map commits to custom version directory names +declare -A commit_to_version=( ["$original_branch"]="salsa2022" ["754eea8b5f8a31b1100ba313d59e41260b494225"]="salsa" ) + +# Loop over the keys (commit hashes or branch names) in the associative array +for commit in "${!commit_to_version[@]}"; do + git checkout $commit + mdbook build + version_dir="versions/${commit_to_version[$commit]}" + mkdir -p $version_dir + mv book/html/* $version_dir + rm -rf book +done + +# Return to the original branch or commit +git checkout $original_branch + +# Copy _redirects to the root directory +cp _redirects versions From fa4dc3ccfe687abfb8a1daac44ad2d40536efec9 Mon Sep 17 00:00:00 2001 From: XFFXFF <1247714429@qq.com> Date: Sun, 29 Oct 2023 10:05:08 +0800 Subject: [PATCH 3/3] update the link to old salsa --- book/src/caveat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/caveat.md b/book/src/caveat.md index b48ed3e8..156de317 100644 --- a/book/src/caveat.md +++ b/book/src/caveat.md @@ -2,4 +2,4 @@ > > This page describes the unreleased "Salsa 2022" version, which is a major departure from older versions of salsa. The code here works but is only available on github and from the `salsa-2022` crate. > -> If you are looking for the older version of salsa, simply visit [this link](https://old-salsa-rs.netlify.app/) +> If you are looking for the older version of salsa, simply visit [this link](https://salsa-rs.netlify.app/salsa)