This script automates the process of updating a static website built with Hugo by:
- Generating the latest version of the site using Hugo
- Committing and pushing changes to a Git repository
- Copying the generated site files to a Neocities folder
- Uploading the updated site to Neocities
Ensure you have the following installed on your system:
- Hugo – A static site generator
- Git – For version control
- Neocities CLI – To push updates to Neocities
- Clone this repository:
git clone https://github.com/your-username/your-repo.git
cd your-repo
- Open the script (update-website.sh) and modify the following paths to match your setup:
HUGO_DIR="/path/to/your/hugo/project"
GIT_DIR="/path/to/your/git/repository"
NEOCITIES_DIR="/path/to/your/neocities/folder"
- Make the script executable:
chmod +x update-website.sh
To run the script and update your website, execute:
./update-website.sh
How It Works
-
The script runs hugo to generate the latest version of the website from the Hugo directory.
- Stages all changes
- Commits with the message "updated site"
- Pushes changes to the Git repository
-
- The generated site files are copied to the Neocities folder.
- Deploy to Neocities: The script navigates to the Neocities directory and pushes the updated site using the Neocities CLI.
Notes
- Ensure you are logged into Neocities CLI before running the script (neocities login).
- Modify the script if you need additional customizations.
- You can automate this script using a cron job for scheduled deployments.
License
This project is open-source under the MIT License.