Pasthis

Raw | New paste
Never expires.
diff --git a/scripts/run-docs-build b/scripts/run-docs-build
index ecc5332..00ecc20 100755
--- a/scripts/run-docs-build
+++ b/scripts/run-docs-build
@@ -92,7 +92,8 @@ cd $ypdocs
 first_sphinx_commit=01dd5af7954e24552aca022917669b27bb0541ed
 first_dunfell_sphinx_commit=c25fe058b88b893b0d146f3ed27320b47cdec236

-latest_tag=$(git tag --contains "$first_sphinx_commit" --contains "$first_dunfell_sphinx_commit" --sort="version:refname" 'yocto-*' | tail -1 | sed 's/yocto-//')
+latest_tag=$(git tag --contains "$first_sphinx_commit" --contains "$first_dunfell_sphinx_commit" --sort="version:refname" 'yocto-*' | tail -1)
+latest_branch=$(git branch --remote --contains "$latest_tag" | grep -v "master" | head -n1 | grep -o "\w*")

 for branch in dunfell $(git branch --remote --contains "$first_sphinx_commit" --format '%(refname:lstrip=3)') $(git tag --contains "$first_sphinx_commit" --contains "$first_dunfell_sphinx_commit" 'yocto-*') transition; do
     if [ "$branch" = "HEAD" ]; then
@@ -138,12 +139,12 @@ for branch in dunfell $(git branch --remote --contains "$first_sphinx_commit" --
     elif [ "$branch" = "master" ]; then
         branch="dev"
         mkdir $outputdir/$branch
-    elif [ "$branch" = "$latest_tag" ]; then
+    elif [ "$branch" = "$latest_branch" ]; then
         branch=""
-        mkdir $outputdir/$latest_tag
-        cp -r ./_build/final/* $outputdir/$latest_tag
-        echo Linking to $latest_tag as current
-        ln -s $latest_tag $outputdir/current
+        mkdir $outputdir/$latest_branch
+        cp -r ./_build/final/* $outputdir/$latest_branch
+        echo Linking to $latest_branch as current
+        ln -s $latest_branch $outputdir/current
     elif [ "$branch" = "transition" ]; then
         branch=""
     else