Build using layout file

This commit is contained in:
Melon 2023-07-29 14:19:09 +01:00
parent 05ed74cd00
commit 1e257680f5
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
8 changed files with 97 additions and 69 deletions

22
+layout.html Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/assets/style.css" />
{{head}}
</head>
<body>
<header>
<h1>🍉 - 1f349.net</h1>
<p>
<a href="/">Home</a>
&nbsp;-&nbsp;
<a href="/hosting">Hosting</a>
&nbsp;-&nbsp;
<a href="https://admin.1f349.net" target="_blank">Admin</a>
</p>
</header>
{{page}}
</body>
</html>

View File

@ -10,8 +10,14 @@ jobs:
- name: Check out Git repository
uses: actions/checkout@v1
- run: sudo apt-get update
- run: sudo apt-get install yq
- name: Build
run: ./compile.sh
- name: Archive
run: tar -czvf upload.tar.gz -C . *
run: tar -czvf upload.tar.gz -C ./build .
- name: Release
run: 'curl -X POST -H "Authorization: Bearer ${{ secrets.DEPLOY }}" -F "upload=@upload.tar.gz" "https://sites.1f349.net/u?site=1f349.net&branch=${{ github.ref_name }}"'

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build/

32
compile.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
function mp() {
echo " <meta property=\"$1\" content=\"$2\">"
}
rm -rf "build/"
find . -name '*.page' -print0 |
while IFS= read -r -d '' ff; do
d=`dirname "$ff"`
f2=`basename "$ff"`
f3="${f2%.page}.html" # build filename
echo "Writing $ff -> $f3"
mkdir -p "build/$d"
exec 3<> "build/$d/$f3"
while IFS= read -r p; do
a=`echo "$p" | tr -d '[:space:]'`
if [ "$a" == "{{head}}" ]; then
echo " <title>$(yq -r '.meta.title' "$ff")</title>" >&3
echo " <meta name=\"author\" content=\"$(yq -r '.meta.title' "$ff")\">" >&3
mp "og:title" "$(yq -r '.meta.og-title' "$ff")" >&3
mp "og:url" "$(yq -r '.meta.og-url' "$ff")" >&3
mp "og:type" "$(yq -r '.meta.og-type' "$ff")" >&3
mp "og:image" "$(yq -r '.meta.og-image' "$ff")" >&3
mp "og:site_name" "$(yq -r '.meta.og-site_name' "$ff")" >&3
elif [ "$a" == "{{page}}" ]; then
yq -r '.content' "$ff" >&3
else
echo "$p" >&3
fi
done < "+layout.html"
exec 3>&-
done

View File

@ -1,37 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/assets/style.css" />
<title>Hosting | 1f349.net</title>
<meta name="author" content="🍉 - 1f349.net">
<meta property="og:title" content="🍉 - 1f349.net">
<meta property="og:url" content="https://1f349.net/hosting">
<meta property="og:type" content="object">
<meta property="og:image" content="https://1f349.net/1f349.svg">
<meta property="og:site_name" content="🍉 - 1f349.net">
</head>
<body>
<main>
<h1>🍉 - 1f349.net Hosting</h1>
<p>
<a href="/">Home</a>
&nbsp;-&nbsp;
<a href="/hosting">Hosting</a>
&nbsp;-&nbsp;
<a href="https://admin.1f349.net" target="_blank">Admin</a>
</p>
<p>We are currently hosting the following domains</p>
<ul>
<li><a href="https://mrmelon54.com" target="_blank" title="🍉">MrMelon54</a></li>
<li><a href="https://captainalm.com" target="_blank" title="Mail API?">Captain ALM</a></li>
<li><a href="https://kikicat123.ca" target="_blank" title="Won games in banana shooter">Kikicat</a></li>
<li><a href="https://remove.directory" target="_blank" title="Lost games in banana shooter">removeDirectory</a></li>
<li><a href="https://discord-plays.xyz" target="_blank" title="Still dead, but alive">Discord Plays</a></li>
<li><a href="https://redstonecompendium.com" target="_blank" title="Always progressing">Redstone Compendium</a></li>
</ul>
</main>
</body>
</html>

20
hosting.page Normal file
View File

@ -0,0 +1,20 @@
meta:
title: "1f349.net Hosting"
author: "1f349.net"
og-title: "1f349.net Hosting"
og-url: "https://1f349.net/hosting"
og-type: "object"
og-image: "https://1f349.net/1f349.svg"
og-site_name: "1f349.net"
content: |
<main>
<p>We are currently hosting the following domains</p>
<ul>
<li><a href="https://mrmelon54.com" target="_blank" title="🍉">MrMelon54</a></li>
<li><a href="https://captainalm.com" target="_blank" title="Mail API?">Captain ALM</a></li>
<li><a href="https://kikicat123.ca" target="_blank" title="Won games in banana shooter">Kikicat</a></li>
<li><a href="https://remove.directory" target="_blank" title="Lost games in banana shooter">removeDirectory</a></li>
<li><a href="https://discord-plays.xyz" target="_blank" title="Still dead, but alive">Discord Plays</a></li>
<li><a href="https://redstonecompendium.com" target="_blank" title="Always progressing">Redstone Compendium</a></li>
</ul>
</main>

View File

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/assets/style.css" />
<title>1f349.net</title>
<meta name="author" content="🍉 - 1f349.net">
<meta property="og:title" content="🍉 - 1f349.net">
<meta property="og:url" content="https://1f349.net">
<meta property="og:type" content="object">
<meta property="og:image" content="https://1f349.net/1f349.svg">
<meta property="og:site_name" content="🍉 - 1f349.net">
</head>
<body>
<main>
<h1>🍉 - 1f349.net</h1>
<p>
<a href="/">Home</a>
&nbsp;-&nbsp;
<a href="/hosting">Hosting</a>
&nbsp;-&nbsp;
<a href="https://admin.1f349.net" target="_blank">Admin</a>
</p>
<code><pre>U+1F349: WATERMELON
Miscellaneous Symbols and Pictographs, U+1F300 - U+1F5FF
Supplementary Multilingual Plane, U+10000 - U+1FFFF</pre></code>
<p>The internal domain for all Melon-hosted services.</p>
</main>
</body>
</html>

15
index.page Normal file
View File

@ -0,0 +1,15 @@
meta:
title: "1f349.net"
author: "1f349.net"
og-title: "1f349.net"
og-url: "https://1f349.net"
og-type: "object"
og-image: "https://1f349.net/1f349.svg"
og-site_name: "1f349.net"
content: |
<main>
<code><pre>U+1F349: WATERMELON
Miscellaneous Symbols and Pictographs, U+1F300 - U+1F5FF
Supplementary Multilingual Plane, U+10000 - U+1FFFF</pre></code>
<p>The internal domain for all Melon-hosted services.</p>
</main>