zishu's blog

zishu's blog

一个热爱生活的博主。https://zishu.me

hugo One-click packaging and uploading to GitHub

Sharing a method for one-click packaging and uploading Hugo to GitHub, assuming you have previously uploaded to a GitHub repository.

Use a sh executable file supported by Windows, create a hugo.sh file in the root directory, and put some commands in it.

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 the hugo.sh file in the folder to run it, 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.

Other

Here I am uploading the entire Hugo directory. If you only want to upload the generated /public, add cd public in the middle.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.