@@ -5,9 +5,12 @@ name: Deploy Documentation - Stable
55on :
66 push :
77 branches : [ master ]
8+ tags :
9+ - ' v*.*.*'
810
911jobs :
1012 build-and-deploy :
13+ if : github.repository == 'FrozenLemonTee/original'
1114 runs-on : ubuntu-latest
1215
1316 steps :
4548 echo '<body>' >> ../original_docs/docs/html/version.html
4649 echo ' <h1>Documentation Version</h1>' >> ../original_docs/docs/html/version.html
4750 echo ' <p>Version: stable</p>' >> ../original_docs/docs/html/version.html
48- echo ' <p>Branch: master</p>' >> index .html
51+ echo ' <p>Branch: master</p>' >> ../original_docs/docs/html/version .html
4952 echo " <p>Build Date: $(date -u)</p>" >> ../original_docs/docs/html/version.html
5053 echo " <p>Commit: ${{ github.sha }}</p>" >> ../original_docs/docs/html/version.html
5154 echo '</body>' >> ../original_docs/docs/html/version.html
@@ -64,12 +67,12 @@ jobs:
6467
6568 cd deploy-repo
6669
67- # Only update stable directory
70+ # Update stable directory
6871 rm -rf stable
6972 mkdir -p stable
7073 cp -r ../../original_docs/docs/html/* stable/
7174
72- # Create index.html redirection
75+ # Regenerate the main index.html to include the latest tag version
7376 echo '<!DOCTYPE html>' > index.html
7477 echo '<html>' >> index.html
7578 echo '<head>' >> index.html
@@ -82,16 +85,47 @@ jobs:
8285 echo ' <li><a href="stable/index.html">Stable (master branch)</a></li>' >> index.html
8386 echo ' <li><a href="latest/index.html">Latest (test branch)</a></li>' >> index.html
8487 echo ' <li><a href="versions/">Tag versions</a></li>' >> index.html
88+ echo ' </ul>' >> index.html
89+ echo ' <p>Recent tag versions:</p>' >> index.html
90+ echo ' <ul>' >> index.html
91+
92+ # Regenerate the list of recent tag versions (last 5)
93+ for dir in $(ls -1 versions/ 2>/dev/null | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r | head -5); do
94+ echo " <li><a href=\"versions/$dir/index.html\">Version $dir</a></li>" >> index.html
95+ done
96+
8597 echo ' </ul>' >> index.html
8698 echo '</body>' >> index.html
8799 echo '</html>' >> index.html
88100
101+ # Also update versions/index.html to ensure that the list of all versions is up to date
102+ echo '<!DOCTYPE html>' > versions/index.html
103+ echo '<html>' >> versions/index.html
104+ echo '<head>' >> versions/index.html
105+ echo ' <title>Versioned Documentation</title>' >> versions/index.html
106+ echo '</head>' >> versions/index.html
107+ echo '<body>' >> versions/index.html
108+ echo ' <h1>Versioned Documentation</h1>' >> versions/index.html
109+ echo ' <p>Select a version:</p>' >> versions/index.html
110+ echo ' <ul>' >> versions/index.html
111+
112+ # List all versions (from newest to oldest)
113+ for dir in $(ls -1 versions/ 2>/dev/null | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r); do
114+ echo " <li><a href=\"$dir/index.html\">Version $dir</a></li>" >> versions/index.html
115+ done
116+
117+ echo ' </ul>' >> versions/index.html
118+ echo ' <p><a href="../stable/index.html">Stable (master branch)</a></p>' >> versions/index.html
119+ echo ' <p><a href="../latest/index.html">Latest (test branch)</a></p>' >> versions/index.html
120+ echo '</body>' >> versions/index.html
121+ echo '</html>' >> versions/index.html
122+
89123 # Submit and push
90124 git add .
91125 if git diff-index --quiet HEAD --; then
92126 echo "No changes to deploy"
93127 else
94- git commit -m "Deploy ${{ steps.version.outputs.docs-version }} documentation from ${{ github.sha }}"
128+ git commit -m "Deploy stable documentation from ${{ github.sha }} and update version lists "
95129 git push origin master
96- echo "✅ Stable documentation deployed successfully"
130+ echo "✅ Stable documentation deployed successfully with updated version lists "
97131 fi
0 commit comments