Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Hugo to 0.52 #11552

Merged
merged 5 commits into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ language: go
go:
- 1.10.2

env:
- HUGO_VERSION=0.49

jobs:
include:
- name: "Testing examples"
Expand All @@ -26,9 +23,6 @@ jobs:
- go test -v k8s.io/website/content/en/examples
- name: "Hugo build"
install:
- curl -L https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-64bit.tar.gz | tar -xz
- mkdir -p ${TRAVIS_HOME}/bin
- mv hugo ${TRAVIS_HOME}/bin
- export PATH=${TRAVIS_HOME}/bin:$PATH
- make travis-hugo-build
script:
- hugo
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DOCKER = docker
HUGO_VERSION = 0.49
HUGO_VERSION = 0.52
DOCKER_IMAGE = kubernetes-hugo
DOCKER_RUN = $(DOCKER) run --rm --interactive --tty --volume $(CURDIR):/src
NODE_BIN = node_modules/.bin
Expand All @@ -13,20 +13,20 @@ help: ## Show this help.
all: build ## Build site with production settings and put deliverables in ./public

build: ## Build site with production settings and put deliverables in ./public
hugo
hugo --minify

build-preview: ## Build site with drafts and future posts enabled
hugo -D -F
hugo --buildDrafts --buildFuture

functions-build:
$(NETLIFY_FUNC) build functions-src

check-headers-file:
scripts/check-headers-file.sh

production-build: build check-headers-file ## Build the production site and ensure that noindex headers aren't added
production-build: check-hugo-versions build check-headers-file ## Build the production site and ensure that noindex headers aren't added

non-production-build: ## Build the non-production site, which adds noindex headers to prevent indexing
non-production-build: check-hugo-versions ## Build the non-production site, which adds noindex headers to prevent indexing
hugo --enableGitInfo

sass-build:
Expand All @@ -36,7 +36,7 @@ sass-develop:
scripts/sass.sh develop

serve: ## Boot the development server.
hugo server --ignoreCache --disableFastRender --buildFuture
hugo server --ignoreCache --buildFuture

docker-image:
$(DOCKER) build . --tag $(DOCKER_IMAGE) --build-arg HUGO_VERSION=$(HUGO_VERSION)
Expand All @@ -46,3 +46,13 @@ docker-build:

docker-serve:
$(DOCKER_RUN) -p 1313:1313 $(DOCKER_IMAGE) hugo server --buildFuture --bind 0.0.0.0

# This command is used only by Travis CI; do not run this locally
travis-hugo-build:
curl -L https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-64bit.tar.gz | tar -xz
mkdir -p ${TRAVIS_HOME}/bin
mv hugo ${TRAVIS_HOME}/bin
export PATH=${TRAVIS_HOME}/bin:$PATH

check-hugo-versions:
scripts/hugo-version-check.sh $(HUGO_VERSION)
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title = "Kubernetes"
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = false
enableRobotsTXT = true
disableBrowserError = true

disableKinds = ["taxonomy", "taxonomyTerm"]

Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ functions = "functions"
command = "make non-production-build"

[build.environment]
HUGO_VERSION = "0.49"
HUGO_VERSION = "0.52"

[context.production.environment]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucperkins, can you further explain why the HUGO_VERSION in netlify.toml is remaining at 0.49? Who/what calls the non-production-build target (why should version 0.49 vs 0.52 matter)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. This should indeed also be 0.52. Fixed.

HUGO_BASEURL = "https://kubernetes.io/"
Expand Down
18 changes: 18 additions & 0 deletions scripts/hugo-version-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

MAIN_HUGO_VERSION=$1
NETLIFY_HUGO_VERSION=$(cat netlify.toml | grep HUGO_VERSION | awk '{ print $3 }' | tr -d '"')

echo ${NETLIFY_HUGO_VERSION}

if [[ ${MAIN_HUGO_VERSION} != ${NETLIFY_HUGO_VERSION} ]]; then
echo """
[FAILURE] The Hugo version set in the Makefile is ${MAIN_HUGO_VERSION} while the version in netlify.toml is ${NETLIFY_HUGO_VERSION}
[FAILURE] Please update these versions so that they are same (consider the higher of the two versions as canonical).
"""
exit 1
else
echo "[SUCCESS] The Hugo versions match between the Makefile and netlify.toml"
exit 0
fi