Skip to content

Commit e843947

Browse files
committed
ci: add Azure Static Web Apps workflow file
on-behalf-of: @Azure opensource@microsoft.com
1 parent 7ff74d4 commit e843947

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Azure Static Web Apps CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, closed]
9+
branches:
10+
- main
11+
12+
jobs:
13+
build_and_deploy_job:
14+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
15+
runs-on: ubuntu-latest
16+
name: Build and Deploy Job
17+
permissions:
18+
id-token: write
19+
contents: read
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
submodules: true
24+
lfs: false
25+
- name: Install OIDC Client from Core Package
26+
run: npm install @actions/core@1.6.0 @actions/http-client
27+
- name: Get Id Token
28+
uses: actions/github-script@v6
29+
id: idtoken
30+
with:
31+
script: |
32+
const coredemo = require('@actions/core')
33+
return await coredemo.getIDToken()
34+
result-encoding: string
35+
- name: Build And Deploy
36+
id: builddeploy
37+
uses: Azure/static-web-apps-deploy@v1
38+
with:
39+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ICY_STONE_0E24E741E }}
40+
action: "upload"
41+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
42+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
43+
app_location: "/" # App source code path
44+
api_location: "" # Api source code path - optional
45+
output_location: "." # Built app content directory - optional
46+
github_id_token: ${{ steps.idtoken.outputs.result }}
47+
###### End of Repository/Build Configurations ######
48+
49+
close_pull_request_job:
50+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
51+
runs-on: ubuntu-latest
52+
name: Close Pull Request Job
53+
steps:
54+
- name: Close Pull Request
55+
id: closepullrequest
56+
uses: Azure/static-web-apps-deploy@v1
57+
with:
58+
action: "close"

0 commit comments

Comments
 (0)