Specify Hugo Version for Azure SWA (Oryx) #
PROMPT: You are getting errors during your build process and notice that Oryx is using an older version of Hugo, you want to change that.
Resources: #
Microsoft Learn: SWA Build Config
Oryx Documentation: Environment Variables
Notes: #
- Oryx looks for either a hugo.toml or a config.toml file and makes a decision on which version of hugo to use based on that. It does not seem to use a version greater than 0.112.0.
- Personally, I noticed this when getting an error regarding hugo.IsMultilingual
Steps: #
- Open up your GitHub Workflow and append an
env:
section to the ‘build_and_deploy_job’ - Under that, set the name to HUGO_VERSION and the value to whichever hugo version you desire. In my case I used 0.128.0 at the time of writing.
- Here an example provided by Microsoft:
with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }} action: 'upload' app_location: '\' api_location: '' output_location: 'public' env: HUGO_VERSION: 0.58.0