One-line change: Deploying a Hugo site to Azure Static Web Apps via GitHub Actions
A couple of hints how to deploy your Hugo site to Azure Static Web Apps (preview)

Azure App Service Static Web Apps as announced at Microsoft Build 2020 is the thing-du-jour and if you haven’t seen it go and read Loiane Groner’s blog post. If you read my previous blog post on how to publish Hugo sites to Azure Storage, you might be wondering how you could deploy your Hugo site to an Azure Static Web App instead.

Basically you need two pieces of information and you’ll be up and running in seconds:

  1. When creating your Azure Static Web App via the Azure Portal Set your App artifact location to public

Showing the Build properties available fot an Azure Static Web App

Figure: Azure Portal showing the properties I am about to create my Static Web App with.

  1. Add the GitHub Action for Hugo from Jake Jarvis to your generated workflow YAML file.

Let the provisioning process complete and you will find a generated YAML file (mine was named azure-static-web-apps-purple-mushroom-0625a9c03.yml !) to your repo. Now you need to add this one line to it:

    - uses: jakejarvis/[email protected]

The ideal place to put this would be right underneath the checkout step. Make sure you have lined up the step correctly (YAML is really fussy about these things!) as shown in the following picture:

Screenshot of a workflow yaml file for context

Figure: Screenshot of the generated yaml file that is checked into my repo by the Static Web App provisioning process. The added line is highlighted.

That’s all you need! If you now commit your workflow file and push to master or your designated branch on your repo you’ll now see the build action pulling down the GitHub Action then executing it right after your checkout step.

GitHub Action running

Figure: This picture shows the anticipated output of the GitHub Action for Hugo as seen within GitHub Actions.

This is really just skimming the surface of Azure Static Web Apps capabilities but thought it might be useful info if you’re getting started with Hugo, Azure Static Web Apps and GitHub Actions.

Happy Building and Deploying!