Deploying the Application to Azure Static Web Apps
We have our application working locally now, nothing better than making it available to the world so that we can show everyone what we have developed.
In this case we are going to use Azure Static Web Apps.
But firstly, what is Azure Static Web Apps? Azure Static Web Apps is a service that automatically builds and deploys full stack web apps to Azure from a code repository. Belo you can see the whole workflow around the ASWA:
And we're going to deploy our application using directly in the Visual Studio Code using the extension:
Open up VS Code and let's get into the Azure Portal right there! Click on the Azure icon and sign in with your Azure account:
Go to the
Create Static Web App with a
Now, follow these steps:
- Include a app name. Ex.: intro-starwars-app
- Select a region for hosting our app.
- Now we need to include the location of our application. For our application will be:
- The final step is to include the location of our build output. In this case, remove
buildand leave blank
A box will open, click on the link:
Open Actions in GitHub
Once you click it, you will be redirected to the GitHub Actions repository page showing the entire build workflow (C.I and C.D).
Now let's return to the Azure Static Web Apps Extension and right click on
And see the app in action!
If you want, you can see the deployed application HERE - Star Wars Intro App
Here I would like to let some good resources about Azure Static Web Apps & GitHub Actions:
✅ Microsoft Learn - Crie e Publique um site estático com Gatsby
And to stay on top of several other news, be sure to follow me on Twitter!
See you! 😍
Top comments (1)
Just in case anyone else has the same issue.
I hit a strange and somewhat nasty problem working through this example.
At some point, when I cut and paste the intro.js file from here into VS Code,
the text got subtly reformatted.
Every line of the code was prefixed with a single space
Unfortunately this meant that some of the code didn't work/trigger as expected.
e.g. the star-field worked, but the start button, scrolling/crawling of the text did not!
Since the only diffence in the code was this preceding space on each line it was pretty tricky to spot!
Was using "Inspect" function in Edge comparing my SWA and Glaucia's working SWA
Not sure if this is a common thing or down to some extension I have in VS Code trying to be a bit too clever!
Thanksfully it was easy to fix once I found it.