aboutsummaryrefslogtreecommitdiff
path: root/ci-gen-index.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ci-gen-index.sh')
-rwxr-xr-xci-gen-index.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/ci-gen-index.sh b/ci-gen-index.sh
new file mode 100755
index 0000000..2c9f777
--- /dev/null
+++ b/ci-gen-index.sh
@@ -0,0 +1,57 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+printf "Generating index.html of build logs... "
+rm -f index.html
+
+cat <<EOF >> index.html
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+
+ <style>
+ pre {
+ display: inline;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>
+ Build logs
+ </h1>
+EOF
+
+for dir in */; do
+ d="${dir%/}"
+ cat <<EOF >> index.html
+ <h2 id="$d">
+ <a href="#$d">
+ $dir
+ </a>
+ </h2>
+ <ul>
+EOF
+ for file in "$d"/*; do
+ cat <<EOF >> index.html
+ <li>
+ <a href="$file">
+ <pre>$file</pre>
+ </a>
+ </li>
+EOF
+ done
+
+ cat <<EOF >> index.html
+ </ul>
+EOF
+done
+
+cat <<EOF >> index.html
+ </body>
+</html>
+EOF
+
+echo "done."