Skip to content

Commit a3e1344

Browse files
Adding skip_api_build
Waiting for the DevOps changes to get merged to release the doc. ------- cc: @craigshoemaker
1 parent 979865d commit a3e1344

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

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

Lines changed: 45 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,10 +218,53 @@ 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+
> To skip the API you need to set the `apiRuntime` to the correct language and version in `staticwebapp.config.json`. Click [here](https://docs.microsoft.com/en-us/azure/static-web-apps/configuration#selecting-the-api-language-runtime-version) for the list of supported language and versions.
226+
```json
227+
{
228+
"platform": {
229+
"apiRuntime": "node:16"
230+
}
231+
}
232+
```
233+
234+
Steps to skip building the API:
235+
236+
- In `staticwebapp.config.json`, set the `apiRuntime` to the correct language and version.
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+
254+
# [Azure Pipelines](#tab/azure-devops)
255+
256+
```yml
257+
...
258+
259+
inputs:
260+
app_location: "src" # App source code path relative to repository root
261+
api_location: "api" # Api source code path relative to repository root - optional
262+
output_location: "public" # Built app content directory, relative to app_location - optional
263+
skip_api_build: true
264+
azure_static_web_apps_api_token: $(deployment_token)
265+
```
223266

267+
---
224268
## Extend build timeout
225269

226270
By default, the app and API builds are limited to 15 minutes. You can extend the build timeout by setting the `build_timeout_in_minutes` property.

0 commit comments

Comments
 (0)