summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-02-11 22:01:28 +0800
committereltrac <hi@eltr.ac>2026-02-11 22:01:28 +0800
commitbb6d3329d8a5b9449ffd48007faebf1d7ea2ddbb (patch)
treec14d08196cb7258fcd7669817cbb743c2bb69dc3 /build.sh
parented9ccdb2150e62a3543cbf88fd84ddb9246a92bd (diff)
refactor: extract data during the building process
external link rank data, hightlights, internal link graph were extracted using Forgejo Action on every push. Now they were extracted on every build, not affecting commit history.
Diffstat (limited to 'build.sh')
-rwxr-xr-x[-rw-r--r--]build.sh46
1 files changed, 43 insertions, 3 deletions
diff --git a/build.sh b/build.sh
index bc071437..6bd621d0 100644..100755
--- a/build.sh
+++ b/build.sh
@@ -1,7 +1,47 @@
#!/bin/sh
+# to build this site, you must have: git, pnpm, go and hugo
+echo "_______ _______ _______ ______ _______ _______ _______ _______ _______ "
+echo "( ____ \( ____ \( ____ \( __ \ ( ____ \( ___ )( ____ )( ____ )( ___ )"
+echo "| ( \/| ( \/| ( \/| ( \ )| ( \/| ( ) || ( )|| ( )|| ( ) |"
+echo "| | | (__ | (__ | | ) || (__ | (___) || (____)|| (____)|| | | |"
+echo "| | ____ | __) | __) | | | || __) | ___ || _____)| __)| | | |"
+echo "| | \_ )| ( | ( | | ) || ( | ( ) || ( | (\ ( | | | |"
+echo "| (___) || (____/\| (____/\| (__/ )| (____/\| ) ( || ) | ) \ \__| (___) |"
+echo "(_______)(_______/(_______/(______/ (_______/|/ \||/ |/ \__/(_______)"
+
+# ========= Pull =========== #
+echo "\n\n1️⃣ Pulling changes from remote.\n"
git pull
-pnpm build:uno:prod
+
+# ======= pre-build ========= #
+echo "\n\n2️⃣ Pre-Build\n"
+pnpm build:uno:prod # build UnoCSS
+
+# check and build Go binaries if needed
+mkdir -p bin
+
+# List of Go programs to build and execute
+go_programs="extract_highlights fetch_webmentions get_external_link_rank get_internal_link_graph"
+
+for program in $go_programs; do
+ if [ ! -f "bin/$program" ]; then
+ echo "Building $program..."
+ cd scripts && go build -o "../bin/$program" "$program.go" && cd ..
+ else
+ echo "$program binary already exists in bin/"
+ fi
+
+ # Execute the binary
+ echo "Running $program..."
+ "./bin/$program"
+done
+
+# build hugo site
+echo "\n\n3️⃣ Hugo!\n"
hugo --gc --minify
-pnpm pagefind --site public
-pnpm wm public/index.xml --limit 1 --send
+
+# post-build
+echo "\n\n4️⃣ Post-Build\n"
+pnpm pagefind --site public # indexing pagefind
+pnpm wm public/index.xml --limit 1 --send # send webmention