forked from dotnet-architecture/eShopOnWeb
-
Notifications
You must be signed in to change notification settings - Fork 1
154 lines (127 loc) · 4.32 KB
/
dotnetcore.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: eShopOnWeb Build and Test
on: [push, pull_request, workflow_dispatch]
jobs:
build-front-end:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
include-prerelease: true
- uses: actions/cache@v2
with:
path: |
~/.nuget/packages
!~/.nuget/packages/unwanted
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Build with dotnet
run: dotnet build ./eShopOnWeb.sln --configuration Release
- name: Test with dotnet
run: dotnet test ./eShopOnWeb.sln --configuration Release
- name: Publish with dotnet
run: dotnet publish ./src/Web/Web.csproj --configuration Release --output ${{ runner.temp }}/publish
- name: Upload artefact
uses: actions/upload-artifact@v2
with:
name: build
path: ${{ runner.temp }}/publish
deploy-front-end:
concurrency: front-end
if: github.event_name != 'pull_request'
needs: build-front-end
runs-on: ubuntu-latest
steps:
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: build
path: ${{ runner.temp }}/build
- uses: azure/login@v1
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
- name: Web App settings
uses: Azure/appservice-settings@v1
with:
app-name: 'eShop-gdbc'
app-settings-json: |
[
{
"name": "baseUrls:apiBase",
"value": "https://eshop-gdbc-backend.azurewebsites.net/"
},
{
"name": "baseUrls:webBase",
"value": "https://eshop-gdbc.azurewebsites.net/"
}
]
connection-strings-json: |
[
]
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/[email protected]
with:
app-name: 'eShop-gdbc'
publish-profile: ${{ secrets.publish_profile }} # Define secret variable in repository settings as per action documentation
package: ${{ runner.temp }}/build
build-back-end:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
include-prerelease: true
- uses: actions/cache@v2
with:
path: |
~/.nuget/packages
!~/.nuget/packages/unwanted
key: ${{ runner.os }}-backend-nuget-${{ hashFiles('**/packages.csproj') }}
restore-keys: |
${{ runner.os }}-backend-nuget-
- name: Build with dotnet
run: dotnet build ./eShopOnWeb.sln --configuration Release
- name: Test with dotnet
run: dotnet test ./eShopOnWeb.sln --configuration Release
- name: Publish with dotnet
run: dotnet publish ./src/PublicApi/PublicApi.csproj --configuration Release --output ${{ runner.temp }}/publish
- name: Upload artefact
uses: actions/upload-artifact@v2
with:
name: build-backend
path: ${{ runner.temp }}/publish
deploy-back-end:
needs: build-back-end
if: github.event_name != 'pull_request'
concurrency: back-end
runs-on: ubuntu-latest
steps:
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: build-backend
path: ${{ runner.temp }}/build-backend
- uses: azure/login@v1
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
- name: Web App settings
uses: Azure/appservice-settings@v1
with:
app-name: 'eShop-gdbc-backend'
app-settings-json: |
[
]
connection-strings-json: |
[
]
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/[email protected]
with:
app-name: 'eShop-gdbc-backend'
publish-profile: ${{ secrets.publish_profile_backend }} # Define secret variable in repository settings as per action documentation
package: ${{ runner.temp }}/build-backend