@@ -5,7 +5,7 @@ services: static-web-apps
5
5
author : craigshoemaker
6
6
ms.service : azure-static-web-apps
7
7
ms.topic : conceptual
8
- ms.date : 10/30 /2024
8
+ ms.date : 11/04 /2024
9
9
ms.author : cshoe
10
10
zone_pivot_groups : static-web-apps-ci-cd
11
11
---
@@ -72,9 +72,6 @@ Use the following steps to set the deployment authorization policy in your app:
72
72
73
73
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.
74
74
75
- > [ !NOTE]
76
- > This example shows a sample configuration that uses an Azure deployment token to secure the build configuration.
77
-
78
75
::: zone pivot="azure-pipelines"
79
76
80
77
``` yaml
@@ -112,7 +109,7 @@ In this configuration:
112
109
113
110
:: : zone pivot="github-actions"
114
111
115
- # [Azure deployment token](#tab/adt )
112
+ # [GitHub access token](#tab/gat )
116
113
117
114
` ` ` yml
118
115
name: Azure Static Web Apps CI/CD
121
118
push:
122
119
branches:
123
120
- main
124
- - dev
125
121
pull_request:
126
122
types: [opened, synchronize, reopened, closed]
127
123
branches:
@@ -132,37 +128,21 @@ jobs:
132
128
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
133
129
runs-on: ubuntu-latest
134
130
name: Build and Deploy Job
135
- permissions:
136
- id-token: write
137
- contents: read
138
131
steps:
139
- - uses: actions/checkout@v3
132
+ - uses: actions/checkout@v2
140
133
with:
141
134
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
153
135
- name: Build And Deploy
154
136
id: builddeploy
155
137
uses: Azure/static-web-apps-deploy@v1
156
138
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)
158
141
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
166
146
###### End of Repository/Build Configurations ######
167
147
168
148
close_pull_request_job:
@@ -174,11 +154,11 @@ jobs:
174
154
id: closepullrequest
175
155
uses: Azure/static-web-apps-deploy@v1
176
156
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 }}
178
158
action: "close"
179
159
` ` `
180
160
181
- # [GitHub access token](#tab/gat )
161
+ # [Azure deployment token](#tab/adt )
182
162
183
163
` ` ` yml
184
164
name: Azure Static Web Apps CI/CD
187
167
push:
188
168
branches:
189
169
- main
170
+ - dev
190
171
pull_request:
191
172
types: [opened, synchronize, reopened, closed]
192
173
branches:
@@ -197,21 +178,37 @@ jobs:
197
178
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
198
179
runs-on: ubuntu-latest
199
180
name: Build and Deploy Job
181
+ permissions:
182
+ id-token: write
183
+ contents: read
200
184
steps:
201
- - uses: actions/checkout@v2
185
+ - uses: actions/checkout@v3
202
186
with:
203
187
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
204
199
- name: Build And Deploy
205
200
id: builddeploy
206
201
uses: Azure/static-web-apps-deploy@v1
207
202
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 }}
210
204
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 }}
215
212
###### End of Repository/Build Configurations ######
216
213
217
214
close_pull_request_job:
@@ -223,7 +220,7 @@ jobs:
223
220
id: closepullrequest
224
221
uses: Azure/static-web-apps-deploy@v1
225
222
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 }}
227
224
action: "close"
228
225
` ` `
229
226
0 commit comments