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
+ # steps:
18
+ # - uses: actions/checkout@v3
19
+ # with:
20
+ # submodules: true
21
+ # lfs: false
22
+ # - name: Install PNPM
23
+ # run: |
24
+ # npm install -g pnpm
25
+ # - name: Install Dependencies
26
+ # run: pnpm install
27
+ # - name: Build Project
28
+ # run: pnpm run build
29
+ # - name: Deploy
30
+ # uses: Azure/static-web-apps-deploy@v1
31
+ # with:
32
+ # azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_POND_0FE43071E }}
33
+ # repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
34
+ # action: "upload"
35
+ # ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
36
+ # # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
37
+ # app_location: "/" # App source code path
38
+ # output_location: "dist"
39
+ # skip_app_build: true
40
+ # # app_build_command: pnpm run build
41
+ # # api_location: "" # Api source code path - optional
42
+ # # output_location: "build" # Built app content directory - optional
43
+ # ###### End of Repository/Build Configurations ######
44
+
45
+ # close_pull_request_job:
46
+ # if: github.event_name == 'pull_request' && github.event.action == 'closed'
47
+ # runs-on: ubuntu-latest
48
+ # name: Close Pull Request Job
49
+ # steps:
50
+ # - name: Close Pull Request
51
+ # id: closepullrequest
52
+ # uses: Azure/static-web-apps-deploy@v1
53
+ # with:
54
+ # azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_POND_0FE43071E }}
55
+ # action: "close"
56
+
57
+
1
58
name : Azure Static Web Apps CI/CD
2
59
3
60
on :
4
61
push :
5
62
branches :
6
- - main
63
+ - main # Adjust to your main branch
7
64
pull_request :
8
65
types : [opened, synchronize, reopened, closed]
9
66
branches :
10
- - main
67
+ - main # Adjust to your main branch
11
68
12
69
jobs :
13
70
build_and_deploy_job :
14
- if : github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
15
71
runs-on : ubuntu-latest
16
72
name : Build and Deploy Job
17
73
steps :
18
- - uses : actions/checkout@v3
19
- with :
20
- submodules : true
21
- lfs : false
22
- - name : Install PNPM
23
- run : |
24
- npm install -g pnpm
25
- - name : Install Dependencies
26
- run : pnpm install
27
- - name : Build Project
28
- run : pnpm run build
29
- - name : Deploy
30
- uses : Azure/static-web-apps-deploy@v1
31
- with :
32
- azure_static_web_apps_api_token : ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_POND_0FE43071E }}
33
- repo_token : ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
34
- action : " upload"
35
- # ##### Repository/Build Configurations - These values can be configured to match your app requirements. ######
36
- # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
37
- app_location : " /" # App source code path
38
- output_location : " dist"
39
- skip_app_build : true
40
- # app_build_command: pnpm run build
41
- # api_location: "" # Api source code path - optional
42
- # output_location: "build" # Built app content directory - optional
43
- # ##### End of Repository/Build Configurations ######
44
-
45
- close_pull_request_job :
46
- if : github.event_name == 'pull_request' && github.event.action == 'closed'
47
- runs-on : ubuntu-latest
48
- name : Close Pull Request Job
49
- steps :
50
- - name : Close Pull Request
51
- id : closepullrequest
52
- uses : Azure/static-web-apps-deploy@v1
53
- with :
54
- azure_static_web_apps_api_token : ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_POND_0FE43071E }}
55
- action : " close"
74
+ - uses : actions/checkout@v2
75
+
76
+ - name : Setup Node.js
77
+ uses : actions/setup-node@v2
78
+ with :
79
+ node-version : ' 14.x'
80
+
81
+ - name : Install pnpm
82
+ run : npm install -g pnpm
83
+
84
+ - name : Install Dependencies
85
+ run : pnpm install
86
+
87
+ - name : Build Project
88
+ run : pnpm run build
89
+
90
+ - name : Check Build Size
91
+ run : du -sh dist
92
+
93
+ - name : Deploy to Azure Static Web Apps
94
+ uses : Azure/static-web-apps-deploy@v1
95
+ with :
96
+ azure_static_web_apps_api_token : ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_POND_0FE43071E }}
97
+ repo_token : ${{ secrets.GITHUB_TOKEN }} # This secret is automatically made available to GitHub Actions runners
98
+ action : " upload"
99
+ app_location : " /"
100
+ output_location : " dist"
101
+ skip_app_build : true
0 commit comments