From 2129d7a3fd8ab6fe2f0513f36f493a257db94736 Mon Sep 17 00:00:00 2001 From: Ian Clarke Date: Sat, 21 Oct 2023 09:05:00 -0500 Subject: [PATCH] Create docs-retro.yml --- .github/workflows/docs-retro.yml | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/docs-retro.yml diff --git a/.github/workflows/docs-retro.yml b/.github/workflows/docs-retro.yml new file mode 100644 index 000000000..14d3dfa6a --- /dev/null +++ b/.github/workflows/docs-retro.yml @@ -0,0 +1,58 @@ +name: Retroactive Documentation Deployment + +on: + workflow_dispatch: # Allows manual triggering of the workflow + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + with: + fetch-depth: 0 # Get the entire history so all tags are available + + - name: Setup Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + + - name: Cache Dependencies + uses: actions/cache@v2 + with: + path: ~/.cargo + key: cargo-cache-${{ hashFiles('**/Cargo.lock') }} + + - name: Install dependencies + run: | + cargo install mdbook mdbook-mermaid mdbook-toc + + - name: Generate and Deploy Documentation + run: | + mkdir -p deploy + tags=$(git tag -l 'v*') # Assumes tag format is v + for tag in $tags; do + git checkout $tag + version=${tag#v} + deploy_dir="deploy/$version" + if [[ ! -d $deploy_dir ]]; then + if [[ -d "docs" ]]; then + cd docs + mdbook build + mv book ../$deploy_dir + cd .. + else + echo "Docs folder not found for tag $tag." + fi + else + echo "Documentation already exists for tag $tag." + fi + done + git checkout main # Return to main branch before deployment + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: deploy + single-commit: true