Since Azure Static Web Apps is still in preview, it is free to use for the time being.
Steps on how to deploy a Redwood app through Azure Static Web Apps:
Prerequisite: Azure & GitHub account, VS Code
-
Install Azure Static Web Apps VS Code extension and follow “Create your first static web app” instruction on the extension page.
-
When asked for the app folder name, enter “/” (without the quotes)
-
When asked for the build artifact folder name, enter “web/dist” (without the quotes, take note that there is no slash before the ‘web’)
-
After created successfully, pull changes from your GitHub repo because Azure will add a new file at the following path
.github\workflows\azure-static-web-apps-*<some-random-value>*.yml
-
Open the
.github\workflows\azure-static-web-apps-*<some-random-value>*.yml
file above, add the following line:
app_build_command: yarn rw build
under this section:jobs > build_and_deploy_job > steps > name > with
You may refer this sample code or this screenshot.
-
Create a new config file
staticwebapp.config.json
at the root of the project with the following content:
The explanation of the code above can be found in the Fallback Routes section of the Azure Static Web Apps Documentation. -
Commit and push your code. Go to your GitHub Actions section you shall see 2 workflow runs, the first one failed because it doesn’t have the custom build command yet, the second successful with the custom build command. Sample link
-
To view the published website, you may get the URL from your Azure portal or from the
GitHub Action log > Build And Deploy
I’m still researching how to set up:
- API side to use Azure Functions
I will update here if I have any progress. In the meantime, feel free to share your config if you know how to do it.
Following are some of my doubts: