Sharing a method for one-click packaging and uploading to GitHub with Hugo, assuming you have previously uploaded to a GitHub repository.
Using a sh executable file supported by Windows, create a hugo.sh
file in the root directory and put some commands inside.
hugo
# cd public
time=$(date "+%Y-%m-%d %H:%M:%S")
echo $time
git add .
git commit -m "Automated build script execution 🎓$time"
git push
exit
You can double-click to run hugo.sh
in the folder, or enter the command in the terminal.
.\hugo.sh
This eliminates the need for me to enter tedious Git upload commands, and automatically generates the current system time as the commit message.
Others
Here I am uploading the entire Hugo directory. If you only want to upload the generated /public
, add cd public
in between.