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

ci(Netlify): specify HUGO_VERSION environment variable once #2221

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

hugo-sid
Copy link
Member

@hugo-sid hugo-sid commented Aug 30, 2023

What does this PR do?

Fixes redundant environment variable specification across contexts.

Explanation

The environment variable HUGO_VERSION holds the same value for all contexts (production, deploy-preview, and branch-deploy). Specifying it separately for each context becomes redundant.

Specifying it once under [build.environment] should be enough.

Reference

From https://docs.netlify.com/configure-builds/file-based-configuration/#deploy-contexts :

any property of a context-aware key, such as [build] or [[plugins]], will be applied to all contexts unless the same property key is present in a more specific context.

Verification

Consider this PR. HUGO_VERSION is not specified for the deploy-preview context in netlify.toml. It can be seen from the corresponding Netlify log that Hugo 0.117.0 was used.

  1. Output in L37

     Installing Hugo 0.117.0
    
  2. Output in L76

     hugo v0.117.0-b2f0696cad918fb61420a6aff173eb36662b406e+extended linux/amd64 BuildDate=2023-08-07T12:49:48Z VendorInfo=gohugoio
    

If an environment variable (`HUGO_VERSION` in this case) is going to be same for all contexts (production, deploy-preview & branch-deploy), then there is no need to specify it for each context.

Specifying it once under [build.environment] should be enough.

From https://docs.netlify.com/configure-builds/file-based-configuration/#deploy-contexts :

"any property of a context-aware key, such as [build] or [[plugins]], will be applied to all contexts unless the same property key is present in a more specific context."
@bep bep merged commit 686c7b6 into gohugoio:master Aug 30, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants