2020-09-20 23:14:51 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Wowchemy Updater
|
|
|
|
# Checks for available updates and then asks to install any updates.
|
|
|
|
# https://wowchemy.com/docs/update/
|
|
|
|
#
|
|
|
|
# Command: bash ./update_wowchemy.sh
|
|
|
|
|
|
|
|
# Check for prerequisites.
|
|
|
|
if [ ! -d content ]; then
|
|
|
|
echo "ERROR: `cd` into your website folder before running this tool."
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Update the Wowchemy Hugo module
|
|
|
|
function update_wowchemy () {
|
|
|
|
# Update Wowchemy to the latest master version
|
|
|
|
echo -e "Updating Wowchemy to the latest master version...\n"
|
|
|
|
hugo mod get github.com/wowchemy/wowchemy-hugo-modules/wowchemy/@master
|
|
|
|
hugo mod tidy
|
|
|
|
}
|
|
|
|
|
|
|
|
# Update Netlify config
|
|
|
|
function update_netlify () {
|
|
|
|
# - Update Netlify.toml with required Hugo version
|
|
|
|
if [ -f ./netlify.toml ]; then
|
2020-11-06 00:40:06 +01:00
|
|
|
curl -o "tmp_get_version" https://raw.githubusercontent.com/wowchemy/wowchemy-hugo-modules/master/wowchemy/config.yaml
|
|
|
|
version=$(sed -n 's/^[[:space:]]*min: //p' "tmp_get_version" | tr -d "'")
|
2020-09-20 23:14:51 +02:00
|
|
|
version="${version}"
|
|
|
|
echo "Set Netlify Hugo version to v${version}"
|
|
|
|
sed -i.bak -e "s/HUGO_VERSION = .*/HUGO_VERSION = \"$version\"/g" ./netlify.toml && rm -f ./netlify.toml.bak
|
|
|
|
rm tmp_get_version
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Perform update
|
|
|
|
update_wowchemy
|
|
|
|
update_netlify
|
|
|
|
|
|
|
|
echo
|
2020-11-06 00:40:06 +01:00
|
|
|
echo "If there are breaking changes, the site structure, config, and/or front matter of content" \
|
2020-09-20 23:14:51 +02:00
|
|
|
"may need upgrading by following the steps in the relevant consecutive release notes."
|
|
|
|
echo
|
|
|
|
echo "View the update guide at: https://wowchemy.com/docs/update/"
|
|
|
|
echo "View the latest release notes at: https://wowchemy.com/updates/"
|