aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremmett1 <me@emmett1.my>2026-05-24 23:34:39 +0800
committeremmett1 <me@emmett1.my>2026-05-24 23:34:39 +0800
commit76229f5bd496504363b58172e2708c7b9ad79c43 (patch)
tree727299aa5ec686d6df797b5fb67c384453614ed9
parentc6e05105528b47a952d5367d5326a349608e456e (diff)
downloadalicelinux-76229f5bd496504363b58172e2708c7b9ad79c43.tar.gz
alicelinux-76229f5bd496504363b58172e2708c7b9ad79c43.zip
updated .woodpecker and buildsite.sh script
-rw-r--r--.woodpecker.yml13
-rw-r--r--files/favicon.svg4
-rw-r--r--files/header1
-rwxr-xr-xutils/buildsite.sh (renamed from buildsite.sh)83
4 files changed, 68 insertions, 33 deletions
diff --git a/.woodpecker.yml b/.woodpecker.yml
index ed13f402..e139e325 100644
--- a/.woodpecker.yml
+++ b/.woodpecker.yml
@@ -8,8 +8,8 @@ steps:
from_secret: "codeberg_token"
commands:
- apk add --no-cache git curl cmark
- - chmod +x ./buildsite.sh
- - ./buildsite.sh
+ - chmod +x ./utils/buildsite.sh
+ - ./utils/buildsite.sh
- git config --global user.email "$${CBMAIL}"
- git config --global user.name "Woodpecker CI"
- git clone -b pages https://$${CBTOKEN}@codeberg.org/$CI_REPO.git $CI_REPO_NAME
@@ -37,6 +37,15 @@ steps:
- git add --all
- git commit -m "Woodpecker CI ${CI_COMMIT_SHA} [SKIP CI]" --allow-empty
- git push
+ - cd ..
+ - rm -rf $CI_REPO_NAME
+ - git clone -b community https://$${CBTOKEN}@codeberg.org/$CI_REPO.git $CI_REPO_NAME
+ - cd $CI_REPO_NAME
+ - git rm -r "*" || true
+ - cp -ar ../repos/community/. . || true
+ - git add --all
+ - git commit -m "Woodpecker CI ${CI_COMMIT_SHA} [SKIP CI]" --allow-empty
+ - git push
when:
event: [push]
diff --git a/files/favicon.svg b/files/favicon.svg
new file mode 100644
index 00000000..17c8a998
--- /dev/null
+++ b/files/favicon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
+ <rect width="32" height="32" rx="4" fill="#0d0d0d"/>
+ <polygon points="16,6 4,28 28,28" fill="none" stroke="#e0e0e0" stroke-width="2.5" stroke-linejoin="round"/>
+</svg>
diff --git a/files/header b/files/header
index bc0b5708..8e32c6c8 100644
--- a/files/header
+++ b/files/header
@@ -4,6 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alice Linux - @TITLE@</title>
+ <link rel="icon" type="image/svg+xml" href="/files/favicon.svg">
<style>
:root {
color-scheme: dark;
diff --git a/buildsite.sh b/utils/buildsite.sh
index ab604e73..e00d3088 100755
--- a/buildsite.sh
+++ b/utils/buildsite.sh
@@ -1,10 +1,25 @@
#!/bin/sh -e
+#
+# Build the Alice Linux static website into public/.
+# Run from the project root.
+#
+# Dependencies: cmark, curl
+
+cd "$(dirname "$0")/.."
+
+for dep in cmark curl; do
+ command -v "$dep" >/dev/null 2>&1 || {
+ printf 'Error: "%s" is required but not found in PATH.\n' "$dep" >&2
+ exit 1
+ }
+done
rm -rf public
mkdir -p public
html_escape() {
- sed 's/\&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g;s/"/\&quot;/g'
+ # takes a single string argument, prints escaped to stdout
+ printf '%s' "$1" | sed 's/\&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g;s/"/\&quot;/g'
}
port_version() {
@@ -44,14 +59,20 @@ generate_ports_page() {
release=$(port_release "$port")
depends=$(port_depends "$port")
[ "$release" ] && version=$version-$release
+
+ e_repo=$(html_escape "$repo")
+ e_name=$(html_escape "$name")
+ e_version=$(html_escape "$version")
+ e_depends=$(html_escape "$depends")
+
printf '<tr data-repo="%s"><td>%s</td><td><a href="https://codeberg.org/emmett1/alicelinux/src/branch/main/repos/%s/%s">%s</a></td><td>%s</td><td>%s</td></tr>\n' \
- "$(printf '%s' "$repo" | html_escape)" \
- "$(printf '%s' "$repo" | html_escape)" \
- "$(printf '%s' "$repo" | html_escape)" \
- "$(printf '%s' "$name" | html_escape)" \
- "$(printf '%s' "$name" | html_escape)" \
- "$(printf '%s' "$version" | html_escape)" \
- "$(printf '%s' "$depends" | html_escape)"
+ "$e_repo" \
+ "$e_repo" \
+ "$e_repo" \
+ "$e_name" \
+ "$e_name" \
+ "$e_version" \
+ "$e_depends"
done
done
@@ -103,20 +124,21 @@ EOF
} > public/ports.html
}
-for i in $(find . -type f -name "*.html" | sed 's|^\./||'); do
+# copy static .html files (from repo root, readme, etc.) into public/
+find . -type f -name "*.html" ! -path './public/*' | sed 's|^\./||' | while IFS= read -r i; do
dir=${i%/*}
file=${i##*/}
title=${dir##*/}
[ "$dir" = "$file" ] && {
title=home; dir=
}
- mkdir -p public/$dir
- echo "copy html for $i..."
+ mkdir -p "public/$dir"
+ printf 'copy html for %s...\n' "$i"
{
sed "s/@TITLE@/$title/g" files/header
- cat $i
+ cat "$i"
cat files/footer
- } > public/$dir/$file
+ } > "public/$dir/$file"
done
generate_ports_page
@@ -243,18 +265,16 @@ EOF
type=$(printf '%s' "$row" | sed 's/.*<td class="t">\([^<]*\)<.*/\1/')
[ "$name" = "../" ] && continue
url="https://dl.alicelinux.org/$href"
+ e_url=$(html_escape "$url")
+ e_name=$(html_escape "$name")
+ e_size=$(html_escape "$size")
+ e_date=$(html_escape "$date")
if [ "$type" = "Directory" ]; then
printf '<tr><td><a href="%s">%s/</a></td><td>%s</td><td>%s</td></tr>\n' \
- "$(printf '%s' "$url" | html_escape)" \
- "$(printf '%s' "$name" | html_escape)" \
- "$(printf '%s' "$size" | html_escape)" \
- "$(printf '%s' "$date" | html_escape)"
+ "$e_url" "$e_name" "$e_size" "$e_date"
else
printf '<tr><td><a href="%s">%s</a></td><td>%s</td><td>%s</td></tr>\n' \
- "$(printf '%s' "$url" | html_escape)" \
- "$(printf '%s' "$name" | html_escape)" \
- "$(printf '%s' "$size" | html_escape)" \
- "$(printf '%s' "$date" | html_escape)"
+ "$e_url" "$e_name" "$e_size" "$e_date"
fi
;;
esac
@@ -333,34 +353,35 @@ EOF
generate_download_page
-# docs
+# build docs index
cat docs/readme.md > docs/index.md
for f in docs/*.md; do
case $f in */readme.md|*/index.md) continue;; esac
- title=$(head -n1 $f)
+ title=$(head -n1 "$f")
file=${f##*/}
echo "- [$title](./${file%.md}.html)" >> docs/index.md
done
-for i in $(find . -type f -name "*.md" | sed 's|^\./||'); do
+# convert markdown to html
+find . -type f -name "*.md" ! -path './public/*' | sed 's|^\./||' | while IFS= read -r i; do
dir=${i%/*}
file=${i##*/}
title=${dir##*/}
[ "$dir" = "$file" ] && {
title=home; dir=
}
- mkdir -p public/$dir
- echo "generating html for $i..."
+ mkdir -p "public/$dir"
+ printf 'generating html for %s...\n' "$i"
{
sed "s/@TITLE@/$title/g" files/header
- cmark $i
+ cmark "$i"
cat files/footer
- } > public/${i%.md}.html
+ } > "public/${i%.md}.html"
done
-# mv readme.html to index.html
-for i in $(find public -type f -name "readme.html" | sed 's|^\./||'); do
- mv -n $i ${i%/*}/index.html
+# move readme.html to index.html
+find public -type f -name "readme.html" | while IFS= read -r i; do
+ mv -n "$i" "${i%/*}/index.html"
done
rm -f docs/index.md