Skip to content

Commit 3adfb1e

Browse files
authored
Merge pull request #192905 from Reshmi-Sriram/patch-3
Adding skip_api_build
2 parents c514b21 + 6939de4 commit 3adfb1e

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

articles/static-web-apps/build-configuration.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The following table lists the available configuration settings.
2424
| `app_build_command` | For Node.js applications, you can define a custom command to build the static content application.<br><br>For example, to configure a production build for an Angular application create an npm script named `build-prod` to run `ng build --prod` and enter `npm run build-prod` as the custom command. If left blank, the workflow tries to run the `npm run build` or `npm run build:azure` commands. | No |
2525
| `api_build_command` | For Node.js applications, you can define a custom command to build the Azure Functions API application. | No |
2626
| `skip_app_build` | Set the value to `true` to skip building the front-end app. | No |
27+
| `skip_api_build` | Set the value to `true` to skip building the API functions. | No |
2728
| `cwd`<br />(Azure Pipelines only) | Absolute path to the working folder. Defaults to `$(System.DefaultWorkingDirectory)`. | No |
2829
| `build_timeout_in_minutes` | Set this value to customize the build timeout. Defaults to `15`. | No |
2930

@@ -217,9 +218,42 @@ inputs:
217218
```
218219

219220
---
221+
## Skip building the API
220222

223+
If you want to skip building the API, you can bypass the automatic build and deploy the API built in a previous step.
221224
> [!NOTE]
222-
> You can only skip the build for the front-end app. The API is always built if it exists.
225+
> Currently the `skip_api_build` is only supported in GitHub Actions and not Azure Pipelines.
226+
227+
Steps to skip building the API:
228+
229+
- In the *staticwebapp.config.json* file, set `apiRuntime` to the correct language and version. Refer to [Configure Azure Static Web Apps](configuration.md#selecting-the-api-language-runtime-version) for the list of supported languages and versions.
230+
```json
231+
{
232+
"platform": {
233+
"apiRuntime": "node:16"
234+
}
235+
}
236+
```
237+
- Set `skip_api_build` to `true`.
238+
239+
# [GitHub Actions](#tab/github-actions)
240+
241+
```yml
242+
...
243+
244+
with:
245+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
246+
repo_token: ${{ secrets.GITHUB_TOKEN }}
247+
action: 'upload'
248+
app_location: "src" # App source code path relative to repository root
249+
api_location: "api" # Api source code path relative to repository root - optional
250+
output_location: "public" # Built app content directory, relative to app_location - optional
251+
skip_api_build: true
252+
```
253+
# [Azure Pipelines](#tab/azure-devops)
254+
This feature is unsupported in Azure Pipelines.
255+
---
256+
---
223257

224258
## Extend build timeout
225259

0 commit comments

Comments
 (0)