Skip to content

Commit

Permalink
Netlify config
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Maddaus <[email protected]>
  • Loading branch information
IanMadd committed Mar 18, 2024
1 parent e77ed02 commit 996a822
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ static/fonts/fontawesome
node_modules
vendor

# dart-sass files for local dev testing
/dart-sass

# temp file created by hugo
.hugo_build.lock

Expand Down
40 changes: 30 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
# we use pushd/popd here, and /bin/sh of our chefes/buildkite image is not bash
# so we have to override the default shell here
SHELL=bash
SHELL=bash -eou pipefail

bundle:
npm:
npm install

bundle: npm netlify_dart_sass

clean_hugo_mod:
hugo mod clean

clean:
rm -rf node_modules
rm -rf dart-sass
rm -rf resources/
rm -rf public/
hugo mod clean

serve: bundle
clean_all: clean clean_hugo_mod

serve: npm
hugo server --buildDrafts --noHTTPCache --buildFuture

metrics: bundle
metrics: npm
hugo --gc --minify --enableGitInfo --templateMetrics --templateMetricsHints

nodrafts: bundle
nodrafts: npm
hugo server --noHTTPCache --buildFuture

production: bundle
hugo server --buildDrafts --noHTTPCache --buildFuture --environment production
hugo --gc --minify --enableGitInfo

deploy_preview: bundle
hugo --gc --minify --enableGitInfo --buildFuture

netlify_dart_sass:
# Hugo requires dart-sass to transpile CSS, but Netlify doesn't support it.
# See https://gohugo.io/functions/resources/tocss/#netlify
@DART_SASS_VERSION="1.71.0"; \
echo $${DART_SASS_VERSION}; \
curl -LJO https://github.com/sass/dart-sass/releases/download/$${DART_SASS_VERSION}/dart-sass-$${DART_SASS_VERSION}-linux-x64.tar.gz; \
tar -xf dart-sass-$${DART_SASS_VERSION}-linux-x64.tar.gz; \
rm dart-sass-$${DART_SASS_VERSION}-linux-x64.tar.gz; \
export PATH=/opt/build/repo/dart-sass:$PATH; \

serve_ignore_vendor: bundle
hugo server --buildDrafts --noHTTPCache --buildFuture --ignoreVendorPaths github.com/**
Expand Down Expand Up @@ -57,15 +77,15 @@ resource_files:
# Verifies that all Cookstyle MD pages exist
verify_cookstyle_pages:
dataDir=generated/_vendor/github.com/chef/cookstyle/docs-chef-io/assets/cookstyle; \
markdownDir=generated/generated_content/workstation/cookstyle; \
markdownDir=generated/generated_content/workstation/cookstyle/cops; \
for f in $$(ls $${dataDir}); \
do mdFile="$${f/.yml/.md}"; \
mdFilePath="$${markdownDir}/$${mdFile/cops_/}"; \
if test ! -f "$${mdFilePath}"; then \
echo "$${mdFilePath} does not exist."; \
fi; \
done; \
if test ! -f "generated/generated_content/workstation/cookstyle/cops.md"; then \
echo "generated/generated_content/workstation/cookstyle/cops.md does not exist."; \
if test ! -f "generated/generated_content/workstation/cookstyle/cops/_index.md"; then \
echo "generated/generated_content/workstation/cookstyle/cops/_index.md does not exist."; \
fi; \

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ for additional information about updating Hugo Modules.
### Update chef-docs-theme module
The theme for this site is deployed from
The theme for this site is sourced from [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme).
Run `make update_theme` to update the theme module and Node package dependencies.
### What if Hugo doesn't update a module

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/chef/chef-web-docs

go 1.22.0
go 1.22

require (
github.com/chef/automate/components/docs-chef-io v0.0.0-20240306133449-4e982f867599 // indirect
Expand Down
6 changes: 3 additions & 3 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
port = 8000

[context.production]
command = "make bundle; hugo --gc --minify --enableGitInfo"
command = "make production"
[context.production.environment]
HUGO_ENV = "production"

[context.deploy-preview]
command = "make bundle; hugo --gc --minify --enableGitInfo --buildFuture"
command = "make deploy_preview"
[context.deploy-preview.environment]
HUGO_ENV = "staging"

[context.branch-deploy]
command = "make bundle; hugo --gc --minify --enableGitInfo"
command = "make production"
[context.branch-deploy.environment]
HUGO_ENV = "branch-deploy"

Expand Down

0 comments on commit 996a822

Please sign in to comment.