This script automates -- for Library staff -- a build of the specified static website. It's designed for a specific purpose: to assemble a static-site directory from two sources:
-
a github repository containing everything but the image and font assets
-
the remote image and font directories
The script updates the local SSG repository directory, then rsyncs assets from a remote server to the local SSG directory.
The purpose of building this way is to be able to have the core of the static-site take advantage of github's versioning, without the churn and unnecessary bloat of including changing binary images.
A proprietary font is used, so the font files are stored on a remote server and synced to the local build directory.
bash
shellgit
rsync
- having git cloned the SSG repository
- likely VPN
- A properly configured
ssg_assemble_dotenv.sh
file in the parent directory
Before running the script, ensure you have a fi_build_dotenv.sh
file in the parent directory with the following environment variables set:
# Remote server configuration
export SSG_ASSEMBLE__REMOTE_SERVER="user@example.com"
export SSG_ASSEMBLE__REMOTE_IMAGE_DIR="/path/to/remote/images"
export SSG_ASSEMBLE__REMOTE_FONT_DIR="/path/to/remote/fonts"
fi_build_stuff/
├── fi_build_script/
│ └── fi_build_script.sh
├── fi_build_dotenv.sh
└── fashioning_insurrection_site_build/
├── img/
└── fonts/
bash ./fi_build_script.sh
- Verifies the working directory
- Sources environment variables from
ssg_assemble_dotenv.sh
- Sets up directory paths
- Updates the local build repository by pulling the latest changes from the github repo
- Syncs images and fonts from the remote server to the local build directory using rsync
The script includes error handling to:
- Verify directory existence and accessibility
- Confirm successful sourcing of environment variables
- Check git operations
- Validate rsync operations
- The script uses
rsync
with the--delete
flag, which will remove files on the local-build that don't exist on the remote-server - Ensure you have proper SSH access to the remote-server
- The script is designed to be run from its own directory and will alert you if it is not run from the correct directory
- remove more references to the
fashioning insurrection
project, so the code is more generic