HUGO

Updating Hugo on Gitlab Pages

Right. So it turns out that one can update .gitlab-ci.yml to run whatever version of Hugo is needed without waiting for the project to be updated on Gitlab Pages.

For example to update Hugo to version 0.22 simply download the Linux 64bit tarred version from https://github.com/spf13/hugo/releases/download/v0.22/hugo_0.22_Linux-64bit.tar.gz.

Then run sha256sum on the .tar.gz

And update you .gitlab-ci.yml like this:

image: alpine
variables:
  HUGO_VERSION: '0.22'
  HUGO_SHA: 'c92b3e09ba95b08a32ec7c432f672e589f95775aa27eb92bc73744afcf8eefa5'
before_script:
  - apk update && apk add openssl ca-certificates
  - wget -O ${HUGO_VERSION}.tar.gz https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
  - echo "${HUGO_SHA}  ${HUGO_VERSION}.tar.gz" | sha256sum -c
  - tar xf ${HUGO_VERSION}.tar.gz && mv hugo* /usr/bin/hugo
  - hugo version
test:
  script:
  - hugo
  except:
  - master
pages:
  script:
  - hugo
  artifacts:
    paths:
    - public
  only:
  - master

Kudos to Achilleas Pipinellis who helped me see the light over here: https://gitlab.com/pages/hugo/issues/12

3 Likes

I suggest you get the SHA from https://github.com/spf13/hugo/releases/download/v0.22/hugo_checksums.txt – which makes more sense if the point is to validate it.

Cool. I’ll use that for reference in the future.

BTW the command gave the exact same SHA value.

I might send a pull request to include this in the Docs, when I have more time in my hands.

Which is kind of the point :slight_smile:

1 Like