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:
- When creating your Azure Static Web App via the Azure Portal Set your App artifact location to
Figure: Azure Portal showing the properties I am about to create my Static Web App with.
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:
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.
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!