fsfe-website/build.sh
delliott d1defc73f8
All checks were successful
continuous-integration/drone/push Build is passing
feat/build-improvements (#4516)
This pr re-formats the build scripts for legibility.
Makes some small tweaks, mainly removing options that don't appear to be used and have no impact.
Updates the help file to be more useful and actually represent all arguments.
Adds the ability to specify languages when building. This is mainly useful for speedups, a full rebuild in just English and French takes only ~3 mins as opposed to 40 for a rebuild of all languages.
There may be some small tweaks not mentioned here, see the commit messages for full details.

This pr does not alter the output of a standard build at all, confirmed using `git diff --no-index`.

Co-authored-by: Darragh Elliott <me@delliott.xyz>
Reviewed-on: #4516
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2024-10-28 13:55:03 +00:00

49 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<-EOF
# build.sh Usage
## General
This script is a wrapper script over ./build/build_main.sh that provides nicer option names, and the options to serve the files.
For documentation on the build script itself see ./build/README.md
## Flags
### -f | --full
Perform a full rebuild of the webpages.
### -s | --serve
Serve the build webpages over localhost.
### --
Everything after this is passed directly to build_main.
See ./build/README.md for valid options.
EOF
exit 1
}
command="build_run"
serve=""
extra_args=""
while [ "$#" -gt 0 ]; do
case "$1" in
--full | -f)
command="build_into" && shift 1
;;
--serve | -s)
serve="true" && shift 1
;;
--)
shift 1
while [ "$#" -gt 0 ]; do
extra_args+="$1 "
shift 1
done
;;
*)
usage
;;
esac
done
mkdir -p ./output
./build/build_main.sh "$command" ./output/final --statusdir ./output/final/status.fsfe.org/fsfe.org/data $extra_args
if [[ "$serve" ]]; then
python3 ./serve-websites.py
fi