@@ -32,20 +32,6 @@ With these settings, you can set up GitHub Actions or [Azure Pipelines](get-star
32
32
33
33
## File name and location
34
34
35
- <!--
36
- ::: zone pivot="azure-pipelines"
37
-
38
-
39
-
40
- ::: zone-end
41
-
42
- ::: zone pivot="github-actions"
43
-
44
-
45
-
46
- ::: zone-end
47
- -->
48
-
49
35
::: zone pivot="azure-pipelines"
50
36
51
37
The GitHub action generates the configuration file and is stored in the * .github/workflows* folder, named using the following format: ` azure-static-web-apps-<RANDOM_NAME>.yml ` .
@@ -109,7 +95,7 @@ In this configuration:
109
95
110
96
:: : zone pivot="github-actions"
111
97
112
- # [GitHub access token](#tab/gat )
98
+ # [Azure deployment token](#tab/adt )
113
99
114
100
` ` ` yml
115
101
name: Azure Static Web Apps CI/CD
118
104
push:
119
105
branches:
120
106
- main
107
+ - dev
121
108
pull_request:
122
109
types: [opened, synchronize, reopened, closed]
123
110
branches:
@@ -128,21 +115,37 @@ jobs:
128
115
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
129
116
runs-on: ubuntu-latest
130
117
name: Build and Deploy Job
118
+ permissions:
119
+ id-token: write
120
+ contents: read
131
121
steps:
132
- - uses: actions/checkout@v2
122
+ - uses: actions/checkout@v3
133
123
with:
134
124
submodules: true
125
+ lfs: false
126
+ - name: Install OIDC Client from Core Package
127
+ run: npm install @actions/[email protected] @actions/http-client
128
+ - name: Get Id Token
129
+ uses: actions/github-script@v6
130
+ id: idtoken
131
+ with:
132
+ script: |
133
+ const coredemo = require('@actions/core')
134
+ return await coredemo.getIDToken()
135
+ result-encoding: string
135
136
- name: Build And Deploy
136
137
id: builddeploy
137
138
uses: Azure/static-web-apps-deploy@v1
138
139
with:
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)
140
+ azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_WATER }}
141
141
action: "upload"
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
142
+ ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
143
+ # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
144
+ app_location: "/" # App source code path
145
+ api_location: "" # Api source code path - optional
146
+ output_location: "dist/angular-basic" # Built app content directory - optional
147
+ production_branch: "dev"
148
+ github_id_token: ${{ steps.idtoken.outputs.result }}
146
149
###### End of Repository/Build Configurations ######
147
150
148
151
close_pull_request_job:
@@ -154,11 +157,11 @@ jobs:
154
157
id: closepullrequest
155
158
uses: Azure/static-web-apps-deploy@v1
156
159
with:
157
- azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
160
+ azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_WATER_030D91C1E }}
158
161
action: "close"
159
162
` ` `
160
163
161
- # [Azure deployment token](#tab/adt )
164
+ # [GitHub access token](#tab/gat )
162
165
163
166
` ` ` yml
164
167
name: Azure Static Web Apps CI/CD
167
170
push:
168
171
branches:
169
172
- main
170
- - dev
171
173
pull_request:
172
174
types: [opened, synchronize, reopened, closed]
173
175
branches:
@@ -178,37 +180,21 @@ jobs:
178
180
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
179
181
runs-on: ubuntu-latest
180
182
name: Build and Deploy Job
181
- permissions:
182
- id-token: write
183
- contents: read
184
183
steps:
185
- - uses: actions/checkout@v3
184
+ - uses: actions/checkout@v2
186
185
with:
187
186
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
199
187
- name: Build And Deploy
200
188
id: builddeploy
201
189
uses: Azure/static-web-apps-deploy@v1
202
190
with:
203
- azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_WATER }}
191
+ azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
192
+ repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for GitHub integrations (i.e. PR comments)
204
193
action: "upload"
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 }}
194
+ ###### Repository/Build Configurations ######
195
+ app_location: "src" # App source code path relative to repository root
196
+ api_location: "api" # Api source code path relative to repository root - optional
197
+ output_location: "public" # Built app content directory, relative to app_location - optional
212
198
###### End of Repository/Build Configurations ######
213
199
214
200
close_pull_request_job:
@@ -220,7 +206,7 @@ jobs:
220
206
id: closepullrequest
221
207
uses: Azure/static-web-apps-deploy@v1
222
208
with:
223
- azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_WATER_030D91C1E }}
209
+ azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
224
210
action: "close"
225
211
` ` `
226
212
0 commit comments