Why am I getting a build error from GitHub Actions when attempting to deploy a no framework static web app on Azure?

Viewed 3204

I have a simple, static website that I'm attempting to deploy as an Azure Static Web App (no framework) using GitHub Actions. My directory structure is:

├── .github/workflows/
├── css/
├── img/
├── js/
├ index.html

When I make a push to the GitHub repo, the Azure Static Web Apps CI/CD action starts the build & deploy job. In my YAML configuration file in the .github/workflows directory, I have set the following for my Repository/Build Configuration:

app_location: "/"    # The app source code is in the root directory for the repo
api_location: ""     # There is no API that needs to be configured
output_location: "/" # my index.html file is in the root directory for the repo

However, I get the following error in my Build and Deploy Job:

Failed to find a default file in the app artifacts folder (/). Valid default files: index.html,Index.html. If your application contains purely static content, please verify that the variable 'app_location' in your workflow file (located in .github/workflows) points to the root of your application.

Why am I getting this error when I've specified where the index.html file is?

2 Answers

Because the deploy container was based on Ubuntu, I guessed that the output location may be getting confused with the root directory for the entire system.

So, I set the output location in the workflow YAML file to:

output_location: "./"

With that change, the build completes and the static web app deploys successfully.

I have the same problem, I tried to run this command locally:

`npm run build`

then I checked the root folder of the app to find what is the name of the build folder and it fixed my problem.

Related