37 lines
1.3 KiB
Org Mode
37 lines
1.3 KiB
Org Mode
#+title: Bajsicki.com
|
|
|
|
This is the git for my personal website. Nothing to see here, just pretty vanilla hugo stuff.
|
|
|
|
* Deployment
|
|
|
|
I'm basing my own deployment of hugo on my server on [[https://jasonmurray.org/posts/2020/githugogen/][this article]] by Jason Murray. I don't have much to change here, and his way of deploying makes a lot of sense to me.
|
|
|
|
I'm breaking it up here with a lot of his comments, simply so I don't get lost when reviewing this in a few years/ months.
|
|
|
|
#+begin_src sh :tangle .git/hooks/post-receive
|
|
#!/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.
|
|
mkdir -p $GIT_WORK_TREE
|
|
chmod 755 $GIT_WORK_TREE
|
|
|
|
# Check out the contents of the repository and extract the files to $GIT_WORK_TREE
|
|
git checkout -f main
|
|
|
|
# Remove any files already in the public directory, a fresh copy will be generated by hugo
|
|
rm -rf $GIT_WORK_TREE/public
|
|
|
|
# Generate the site with hugo
|
|
cd $GIT_WORK_TREE && /usr/bin/hugo
|
|
|
|
# Fix any permission problems.
|
|
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 generation complete"
|
|
#+end_src
|