Skip to content

Commit e562b0e

Browse files
reformat tabs
1 parent 383b995 commit e562b0e

File tree

1 file changed

+36
-39
lines changed

1 file changed

+36
-39
lines changed

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

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: static-web-apps
55
author: craigshoemaker
66
ms.service: azure-static-web-apps
77
ms.topic: conceptual
8-
ms.date: 10/30/2024
8+
ms.date: 11/04/2024
99
ms.author: cshoe
1010
zone_pivot_groups: static-web-apps-ci-cd
1111
---
@@ -72,9 +72,6 @@ Use the following steps to set the deployment authorization policy in your app:
7272

7373
The following sample configuration monitors the repository for changes. As commits are pushed to the `main` branch, the application is built from the `app_location` folder and files in the `output_location` are served to the public web. Additionally, the application in the *api* folder is available under the site's `api` path.
7474

75-
> [!NOTE]
76-
> This example shows a sample configuration that uses an Azure deployment token to secure the build configuration.
77-
7875
::: zone pivot="azure-pipelines"
7976

8077
```yaml
@@ -112,7 +109,7 @@ In this configuration:
112109

113110
::: zone pivot="github-actions"
114111

115-
# [Azure deployment token](#tab/adt)
112+
# [GitHub access token](#tab/gat)
116113

117114
```yml
118115
name: Azure Static Web Apps CI/CD
@@ -121,7 +118,6 @@ on:
121118
push:
122119
branches:
123120
- main
124-
- dev
125121
pull_request:
126122
types: [opened, synchronize, reopened, closed]
127123
branches:
@@ -132,37 +128,21 @@ jobs:
132128
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
133129
runs-on: ubuntu-latest
134130
name: Build and Deploy Job
135-
permissions:
136-
id-token: write
137-
contents: read
138131
steps:
139-
- uses: actions/checkout@v3
132+
- uses: actions/checkout@v2
140133
with:
141134
submodules: true
142-
lfs: false
143-
- name: Install OIDC Client from Core Package
144-
run: npm install @actions/[email protected] @actions/http-client
145-
- name: Get Id Token
146-
uses: actions/github-script@v6
147-
id: idtoken
148-
with:
149-
script: |
150-
const coredemo = require('@actions/core')
151-
return await coredemo.getIDToken()
152-
result-encoding: string
153135
- name: Build And Deploy
154136
id: builddeploy
155137
uses: Azure/static-web-apps-deploy@v1
156138
with:
157-
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_WATER }}
139+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
140+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for GitHub integrations (i.e. PR comments)
158141
action: "upload"
159-
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
160-
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
161-
app_location: "/" # App source code path
162-
api_location: "" # Api source code path - optional
163-
output_location: "dist/angular-basic" # Built app content directory - optional
164-
production_branch: "dev"
165-
github_id_token: ${{ steps.idtoken.outputs.result }}
142+
###### Repository/Build Configurations ######
143+
app_location: "src" # App source code path relative to repository root
144+
api_location: "api" # Api source code path relative to repository root - optional
145+
output_location: "public" # Built app content directory, relative to app_location - optional
166146
###### End of Repository/Build Configurations ######
167147
168148
close_pull_request_job:
@@ -174,11 +154,11 @@ jobs:
174154
id: closepullrequest
175155
uses: Azure/static-web-apps-deploy@v1
176156
with:
177-
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_WATER_030D91C1E }}
157+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
178158
action: "close"
179159
```
180160

181-
# [GitHub access token](#tab/gat)
161+
# [Azure deployment token](#tab/adt)
182162

183163
```yml
184164
name: Azure Static Web Apps CI/CD
@@ -187,6 +167,7 @@ on:
187167
push:
188168
branches:
189169
- main
170+
- dev
190171
pull_request:
191172
types: [opened, synchronize, reopened, closed]
192173
branches:
@@ -197,21 +178,37 @@ jobs:
197178
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
198179
runs-on: ubuntu-latest
199180
name: Build and Deploy Job
181+
permissions:
182+
id-token: write
183+
contents: read
200184
steps:
201-
- uses: actions/checkout@v2
185+
- uses: actions/checkout@v3
202186
with:
203187
submodules: true
188+
lfs: false
189+
- name: Install OIDC Client from Core Package
190+
run: npm install @actions/[email protected] @actions/http-client
191+
- name: Get Id Token
192+
uses: actions/github-script@v6
193+
id: idtoken
194+
with:
195+
script: |
196+
const coredemo = require('@actions/core')
197+
return await coredemo.getIDToken()
198+
result-encoding: string
204199
- name: Build And Deploy
205200
id: builddeploy
206201
uses: Azure/static-web-apps-deploy@v1
207202
with:
208-
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
209-
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for GitHub integrations (i.e. PR comments)
203+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_WATER }}
210204
action: "upload"
211-
###### Repository/Build Configurations ######
212-
app_location: "src" # App source code path relative to repository root
213-
api_location: "api" # Api source code path relative to repository root - optional
214-
output_location: "public" # Built app content directory, relative to app_location - optional
205+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
206+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
207+
app_location: "/" # App source code path
208+
api_location: "" # Api source code path - optional
209+
output_location: "dist/angular-basic" # Built app content directory - optional
210+
production_branch: "dev"
211+
github_id_token: ${{ steps.idtoken.outputs.result }}
215212
###### End of Repository/Build Configurations ######
216213
217214
close_pull_request_job:
@@ -223,7 +220,7 @@ jobs:
223220
id: closepullrequest
224221
uses: Azure/static-web-apps-deploy@v1
225222
with:
226-
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
223+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_WATER_030D91C1E }}
227224
action: "close"
228225
```
229226

0 commit comments

Comments
 (0)