My personal website.
Find a file
2024-11-18 18:09:52 +01:00
archetypes First. 2024-09-24 23:49:00 +02:00
assets Third. 2024-09-26 11:11:01 +02:00
content Update 2024-11-18 18:09:52 +01:00
resources/_gen/assets fixed the sidenotes... I think, maybe? 2024-09-28 04:33:38 +02:00
static Post-receive git hook, live test. 2024-09-27 15:31:20 +02:00
themes fixed the sidenotes... I think, maybe? 2024-09-28 04:33:38 +02:00
.gitignore moving to hugo 2024-09-28 01:33:01 +02:00
.gitmodules Update... 2024-09-27 19:18:44 +02:00
.hugo_build.lock Third. 2024-09-26 11:11:01 +02:00
go.mod Second. 2024-09-26 11:09:00 +02:00
go.sum Second. 2024-09-26 11:09:00 +02:00
hugo.yaml code block adjustment 2024-09-28 01:45:04 +02:00
README.org Update 2024.11.18 15:52 CET 2024-11-18 15:52:19 +01:00

Bajsicki.com

This is the git for my personal website. Nothing to see here, just pretty vanilla hugo stuff.

Deployment

I'm using a git hook to automatically purge and re-build the /public directory after each commit. I don't get enough traffic for this to be an inconvenience.

I used some of this article by Jason Murray to help me understand how git hooks work. I'm running Forgejo, and this is a much more elegant and simple solution when compared to running Actions or other CI/CD tools.

The post-receive hook is like so:

#!/bin/bash
# Directory on the server where the website will be mapped.
export GIT_WORK_TREE=/srv/bajsicki.com/

echo `pwd`
echo "post-receive: Generating https://bajsicki.com with Hugo..."

# Create the directory and all subdirectories if they don't exist.
echo "post-receive: Creating directory and subdirs if they don't exist."
mkdir -p $GIT_WORK_TREE
chmod 755 $GIT_WORK_TREE

# Remove any files already in the public directory, a fresh copy will be generated by hugo
echo "post-receive: Cleaning the /public directory."
rm -rf $GIT_WORK_TREE/public
# Update the modules in case of changes and pull the new pages
echo "post-receive: pulling git repo and submodules"
cd $GIT_WORK_TREE && git pull --recurse-submodules

# Generate the site with hugo
echo "post-receive: running hugo"
cd $GIT_WORK_TREE && hugo


# Fix any permission problems.
echo "post-receive: fixing permissions"
find $GIT_WORK_TREE/public -type f -print | xargs -d '\n' chmod 644
find $GIT_WORK_TREE/public -type d -print | xargs -d '\n' chmod 755

echo "post-receive: Hugo site deployment complete"