Compare commits

...

19 Commits

Author SHA1 Message Date
5becd1c6ea Update style. 2026-04-26 13:50:46 +01:00
57d92d7584 Add width. 2026-04-26 13:44:45 +01:00
6359c4ded5 Use a less prominent title. 2026-04-24 23:00:05 +01:00
26c115b7e1 Add safeguard for failed clone. 2026-04-20 17:06:03 +01:00
b2fe7f7a7f Fix apply.sh error. 2026-04-20 17:04:30 +01:00
29d6ef5ad0 Add more safety precautions. 2026-04-20 17:01:32 +01:00
f397c33ac0 Add warning message. 2026-04-20 17:00:37 +01:00
c4b43e6c6e More logging 2026-04-20 16:58:23 +01:00
cec88c7b68 More error handling. 2026-04-20 16:57:39 +01:00
bff7796f69 Add more logging. 2026-04-20 16:52:17 +01:00
856df4fd50 Don't log warnings for head -cN related feed exits 2026-04-20 16:51:17 +01:00
be86e12b8d Add logging. 2026-04-20 16:43:55 +01:00
76059ede6c Add logging. 2026-04-20 16:43:45 +01:00
3c4522648a Re-personalise after updates. 2026-04-20 16:38:16 +01:00
3856bc6a9a Style changes. 2026-04-20 16:35:11 +01:00
43eccf78e3 Update style. 2026-04-20 16:26:59 +01:00
360ceabc13 Add more safety. 2026-04-20 15:47:12 +01:00
cb0f6fb90d Place env vars in separate file. 2026-04-20 15:35:30 +01:00
aea4b209d7 Update rules. 2026-04-20 15:32:47 +01:00
4 changed files with 50 additions and 22 deletions

View File

@@ -7,3 +7,16 @@ if [ ! -d "$dst_dir" ]; then
fi
mkdir -p "$dst_dir"
./git-portfolio "$dst"
tmp_web_footer_dir="/tmp/web-footer-$(date +%N)"
echo Cloning web-footer to "$tmp_web_footer_dir"... >&2
git clone --depth 1 --branch main git@git.seanhealy.ie:sean/web-footer.git "$tmp_web_footer_dir"
if [ $? != 0 ] || [ ! -d "$tmp_web_footer_dir" ]; then
echo "Failed to clone web-footer repository." >&2
exit 1
fi
echo Re-personalising HTML files... >&2
(cd "$tmp_web_footer_dir" && ./automation/personalise.sh)
echo Cleaning up... >&2
if [ "$tmp_web_footer_dir" ] && [ -d "$tmp_web_footer_dir" ] && [ -d "$tmp_web_footer_dir/.git" ]; then
rm -rf "$tmp_web_footer_dir"
fi

View File

@@ -1 +1 @@
apply modified:/git-portfolio
apply when modified:(/git-portfolio or /automation/apply.sh)

8
env Normal file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/bash
GIT_URL=https://git.seanhealy.ie
GIT_USER=sean
GITHUB_USER=seanhly
GITLAB_USER=seanhly
CODEBERG_USER=seanhly
TOKEN="$(pass gitea-api-token)"
EXCLUDE_LANGUAGES=(Makefile TeX)

View File

@@ -1,11 +1,12 @@
#!/usr/bin/bash
repos="/tmp/repos-$(cat /dev/urandom | base64 | tr -d '=+/' | head -c 8)"
N=/dev/null
repos="/tmp/repos-$(cat /dev/urandom 2>$N | base64 2>$N | tr -d '=+/' 2>$N | head -c 8)"
if [ -d "$repos" ]; then
echo "Error: Temporary directory '$repos' already exists." >&2
exit 1
fi
mkdir -p "$repos"
tmp_portfolio="/tmp/portfolio-$(cat /dev/urandom | base64 | tr -d '=+/' | head -c 8)"
tmp_portfolio="/tmp/portfolio-$(cat /dev/urandom 2>$N | base64 2>$N | tr -d '=+/' 2>$N | head -c 8)"
if [ -d "$tmp_portfolio" ]; then
echo "Error: Temporary directory '$tmp_portfolio' already exists." >&2
exit 1
@@ -16,10 +17,13 @@ function safely_remove_tmp_repos() {
echo "Warning: No git repositories found in '$repos'. Not deleting to prevent data loss."
rmdir "$repos" 2>/dev/null
return
else
rm -rf "$repos"
fi
rm -rf "$repos"
fi
rm -r "$tmp_portfolio"
if [ "$tmp_portfolio" ] && [ -d "$tmp_portfolio" ]; then
rm -r "$tmp_portfolio"
fi
}
function cleanup() {
safely_remove_tmp_repos
@@ -27,6 +31,7 @@ function cleanup() {
trap cleanup EXIT
directory="$1"
script_dir="$(dirname "$0")"
. "$script_dir/env"
if [ ! "$directory" ]; then
echo "Usage: $0 <directory>"
exit 1
@@ -47,13 +52,6 @@ if ! command -v quarto >/dev/null 2>&1; then
echo "Error: 'quarto' command not found. Please install Quarto to render project pages."
exit 1
fi
GIT_URL='https://git.seanhealy.ie'
GIT_USER=sean
GITHUB_USER=seanhly
GITLAB_USER=seanhly
CODEBERG_USER=seanhly
TOKEN="$(pass gitea-api-token)"
EXCLUDE_LANGUAGES=(Makefile TeX)
function my_curl() {
curl -s "$GIT_URL/api/v1/users/$GIT_USER/repos" \
-H 'Accept: application/json' \
@@ -167,14 +165,15 @@ EOF
EOF
)"
done < <(my_curl)
portfolio_index="$(
cat <<EOF
if [ "$portfolio_index" ]; then
portfolio_index="$(
cat <<EOF
<!DOCTYPE html>
<html>
<head>
<title>Projects</title>
<body>
<h1>Projects</h1>
<h2>Projects</h2>
<div id="git-portfolio">
<style>
#git-portfolio {
@@ -187,19 +186,23 @@ cat <<EOF
border-radius: 20px;
background: linear-gradient(30deg, rgba(100, 43, 200, 0.4), rgba(198, 66, 110, 0.4));
position: relative;
width: calc(100% - 25px);
box-sizing: border-box;
max-width: 420px;
max-width: 100%;
height: 100%;
}
#git-portfolio a {
color: black;
text-decoration: none;
display: inline-flex;
flex-direction: column;
flex-grow: 1;
min-width: 400px;
max-width: 450px;
max-width: calc(100%);
box-sizing: content-box;
width: 25%;
}
@media (max-width: 800px) {
#git-portfolio a {
width: 100%;
}
}
#git-portfolio section ul.languages {
float: right;
@@ -221,8 +224,11 @@ li.language {
$portfolio_index
</div>
EOF
)"
echo "$portfolio_index" > "$tmp_portfolio/index.html"
)"
echo "$portfolio_index" > "$tmp_portfolio/index.html"
else
echo "Warning: No public repositories found for user '$GIT_USER'. Portfolio will be empty." >&2
fi
if [ -d "$directory" ]; then
if [ "$(du -sb "$directory" | cut -f1)" -gt $((1024 * 1024 * 400)) ]; then
echo "Error: Directory '$directory' contains more than 400MB of data. Exiting to prevent data loss."
@@ -232,3 +238,4 @@ else
mkdir -p "$directory"
fi
rsync -a "$tmp_portfolio/" "$directory/"
echo "Done! Portfolio generated in '$directory'." >&2