Although Azure provides already a GitHub Actions for Azure Web App to deploy static files to Azure Web App, but we can also do it ourselves with a azure cli command.
Suppose the static files are generated in a folder named
site, then the above Azure doc says we can use the following command to deploy it to Azure Web App:
# action actions/checkout should be run before this step - name: Set Web App runtime run: | az webapp config set \ --resource-group $ \ --name $ \ --linux-fx-version "STATICSITE|1.0" - name: Run Azure webapp deploy action using Azure Credentials uses: azure/webapps-deploy@v2 with: app-name: $ package: site
We manually set the web app runtime to
STATICSITE|1.0 as users might created the web app with other runtime (
STATICSITE|1.0 is not selectable during the standard Web App resource creation except they chose specifically the Static Web App resource), as we’re pushing static files, we should set the runtime to
The above github action could be replaced with:
# action actions/checkout should be run before this step - name: Run Azure Cli using Azure Credentials run: | cd site && zip -r ../site.zip * && cd .. az webapp config set \ --resource-group $ \ --name $ \ --linux-fx-version "STATICSITE|1.0" az webapp deployment source config-zip \ --resource-group $ \ --name $ \ --src site.zip
az webapp deploy --src-path site.zip --type zip instead of
az webapp deployment source config-zip, we get the exact same reboot error as azure/webapps-deploy@
v3 action updates the web app with the new version despite the reboot error, but
az webapp deploy does not update the web app with the new version.