Skip to content

Commit

Permalink
update workflows (#99)
Browse files Browse the repository at this point in the history
Co-authored-by: Georg Schramm <[email protected]>
  • Loading branch information
gschramm and Georg Schramm authored Nov 15, 2024
1 parent efe8539 commit 1754e91
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,23 @@ jobs:
git checkout gh-pages
# Determine redirect target
tagged_versions=$(ls _build/html | grep '^v')
tagged_versions=$(ls _build/html | grep '^v' || true)
if [ -n "$tagged_versions" ]; then
latest_tag=$(echo "$tagged_versions" | sort -V | tail -n 1)
redirect_target="$latest_tag/index.html"
else
redirect_target="master/index.html"
fi
# Ensure _build/html directory exists
mkdir -p _build/html
# Ensure index.html can be overwritten
if [ -f _build/html/index.html ]; then
echo "Overwriting existing _build/html/index.html"
rm _build/html/index.html
fi
# Create index.html for redirect
echo '<!DOCTYPE html>' > _build/html/index.html
echo '<html>' >> _build/html/index.html
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/rebuild_all_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,28 @@ jobs:
run: sphinx-multiversion docs/source _build/html

- name: Create index.html redirect
if: env.build_context != 'pr'
run: |
git fetch origin gh-pages
git checkout gh-pages
# Determine redirect target
tagged_versions=$(ls _build/html | grep '^v')
tagged_versions=$(ls _build/html | grep '^v' || true)
if [ -n "$tagged_versions" ]; then
latest_tag=$(echo "$tagged_versions" | sort -V | tail -n 1)
redirect_target="$latest_tag/index.html"
else
redirect_target="master/index.html"
fi
# Ensure _build/html directory exists
mkdir -p _build/html
# Ensure index.html can be overwritten
if [ -f _build/html/index.html ]; then
echo "Overwriting existing _build/html/index.html"
rm _build/html/index.html
fi
# Create index.html for redirect
echo '<!DOCTYPE html>' > _build/html/index.html
echo '<html>' >> _build/html/index.html
Expand Down

0 comments on commit 1754e91

Please sign in to comment.