Installing release hugo via script

I tossed together a script (a zsh function in this case) to install the release version of hugo on my mac. This assumes things like you have a mac with jq installed, but it could be adapted to linux easily, and Windows with a little work (jq exists for Windows and linux).

A couple of points -

  • gets the dir you’re in when you run it, and dumps you back there on exit
  • gets the current release version of hugo via the github api, using jq, and deletes the v from that string using tr
  • assumes your environment is set up and you have a GOPATH var, and that that’s in your system path
  • makes a hugo-prev by copying the old symlink you have, so you can easily compare current to previous
  • unzips the downloaded tarball into a tmp folder then deletes that later
  • copies the downloaded hugo to a file with the version name in it, so you can reference it later if needed

It’s quick and dirty, but it might help someone at least get started automating a little.

FYI,
Rick

1 Like

There’s another thread with some good info that could be adapted, here: