When you deploy a Hugo framework on AWS Amplify, by default an old version of Hugo is used. I prefer to work with the latest version, but also to control the exact version to work with on my workstation and on production. That's why I created a custom deployment script you can find below. Just put it in the root of your application repository.
Either it's not possible, or I haven't found the solution for using variables throughout the build script. As far as I know it's also not possible to retrieve the domain name for your website to use the same build script for your staging and live websites. If you can help me, please let me know! I'll update this blog post asap.