Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a link to the older version of Salsa in the document #451

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions book/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Redirects from what the browser requests to what we serve
/ /salsa2022
32 changes: 31 additions & 1 deletion book/netlify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ======================================================================
# 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
2 changes: 2 additions & 0 deletions book/src/caveat.md
Original file line number Diff line number Diff line change
@@ -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://salsa-rs.netlify.app/salsa)
Loading