Compare commits
21 Commits
5afda70f4c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5becd1c6ea | |||
| 57d92d7584 | |||
| 6359c4ded5 | |||
| 26c115b7e1 | |||
| b2fe7f7a7f | |||
| 29d6ef5ad0 | |||
| f397c33ac0 | |||
| c4b43e6c6e | |||
| cec88c7b68 | |||
| bff7796f69 | |||
| 856df4fd50 | |||
| be86e12b8d | |||
| 76059ede6c | |||
| 3c4522648a | |||
| 3856bc6a9a | |||
| 43eccf78e3 | |||
| 360ceabc13 | |||
| cb0f6fb90d | |||
| aea4b209d7 | |||
| 1b529945d0 | |||
| 502b414e67 |
@@ -7,3 +7,16 @@ if [ ! -d "$dst_dir" ]; then
|
|||||||
fi
|
fi
|
||||||
mkdir -p "$dst_dir"
|
mkdir -p "$dst_dir"
|
||||||
./git-portfolio "$dst"
|
./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
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
apply modified:/git-portfolio
|
apply when modified:(/git-portfolio or /automation/apply.sh)
|
||||||
|
|||||||
8
env
Normal file
8
env
Normal 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)
|
||||||
@@ -1,21 +1,29 @@
|
|||||||
#!/usr/bin/bash
|
#!/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
|
if [ -d "$repos" ]; then
|
||||||
echo "Error: Temporary directory '$repos' already exists."
|
echo "Error: Temporary directory '$repos' already exists." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
mkdir -p "$repos"
|
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
|
||||||
|
fi
|
||||||
function safely_remove_tmp_repos() {
|
function safely_remove_tmp_repos() {
|
||||||
if [ "$repos" ] && [ -d "$repos" ]; then
|
if [ "$repos" ] && [ -d "$repos" ]; then
|
||||||
if [ "$(find -name .git -type d | wc -l)" -eq 0 ]; then
|
if [ "$(find -name .git -type d | wc -l)" -eq 0 ]; then
|
||||||
echo "Warning: No git repositories found in '$repos'. Not deleting to prevent data loss."
|
echo "Warning: No git repositories found in '$repos'. Not deleting to prevent data loss."
|
||||||
rmdir "$repos" 2>/dev/null
|
rmdir "$repos" 2>/dev/null
|
||||||
return
|
return
|
||||||
fi
|
else
|
||||||
rm -rf "$repos"
|
rm -rf "$repos"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$tmp_portfolio" ] && [ -d "$tmp_portfolio" ]; then
|
||||||
rm -r "$tmp_portfolio"
|
rm -r "$tmp_portfolio"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
safely_remove_tmp_repos
|
safely_remove_tmp_repos
|
||||||
@@ -23,6 +31,7 @@ function cleanup() {
|
|||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
directory="$1"
|
directory="$1"
|
||||||
script_dir="$(dirname "$0")"
|
script_dir="$(dirname "$0")"
|
||||||
|
. "$script_dir/env"
|
||||||
if [ ! "$directory" ]; then
|
if [ ! "$directory" ]; then
|
||||||
echo "Usage: $0 <directory>"
|
echo "Usage: $0 <directory>"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -43,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."
|
echo "Error: 'quarto' command not found. Please install Quarto to render project pages."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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() {
|
function my_curl() {
|
||||||
curl -s "$GIT_URL/api/v1/users/$GIT_USER/repos" \
|
curl -s "$GIT_URL/api/v1/users/$GIT_USER/repos" \
|
||||||
-H 'Accept: application/json' \
|
-H 'Accept: application/json' \
|
||||||
@@ -163,6 +165,7 @@ EOF
|
|||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
done < <(my_curl)
|
done < <(my_curl)
|
||||||
|
if [ "$portfolio_index" ]; then
|
||||||
portfolio_index="$(
|
portfolio_index="$(
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -170,7 +173,7 @@ cat <<EOF
|
|||||||
<head>
|
<head>
|
||||||
<title>Projects</title>
|
<title>Projects</title>
|
||||||
<body>
|
<body>
|
||||||
<h1>Projects</h1>
|
<h2>Projects</h2>
|
||||||
<div id="git-portfolio">
|
<div id="git-portfolio">
|
||||||
<style>
|
<style>
|
||||||
#git-portfolio {
|
#git-portfolio {
|
||||||
@@ -183,19 +186,23 @@ cat <<EOF
|
|||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
background: linear-gradient(30deg, rgba(100, 43, 200, 0.4), rgba(198, 66, 110, 0.4));
|
background: linear-gradient(30deg, rgba(100, 43, 200, 0.4), rgba(198, 66, 110, 0.4));
|
||||||
position: relative;
|
position: relative;
|
||||||
width: calc(100% - 25px);
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
max-width: 420px;
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
#git-portfolio a {
|
#git-portfolio a {
|
||||||
color: black;
|
color: black;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex-grow: 1;
|
max-width: calc(100%);
|
||||||
min-width: 400px;
|
|
||||||
max-width: 450px;
|
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
#git-portfolio a {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#git-portfolio section ul.languages {
|
#git-portfolio section ul.languages {
|
||||||
float: right;
|
float: right;
|
||||||
@@ -219,6 +226,9 @@ li.language {
|
|||||||
EOF
|
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 [ -d "$directory" ]; then
|
||||||
if [ "$(du -sb "$directory" | cut -f1)" -gt $((1024 * 1024 * 400)) ]; 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."
|
echo "Error: Directory '$directory' contains more than 400MB of data. Exiting to prevent data loss."
|
||||||
@@ -228,3 +238,4 @@ else
|
|||||||
mkdir -p "$directory"
|
mkdir -p "$directory"
|
||||||
fi
|
fi
|
||||||
rsync -a "$tmp_portfolio/" "$directory/"
|
rsync -a "$tmp_portfolio/" "$directory/"
|
||||||
|
echo "Done! Portfolio generated in '$directory'." >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user