-
Notifications
You must be signed in to change notification settings - Fork 4
73 lines (55 loc) · 1.91 KB
/
main.yml
File metadata and controls
73 lines (55 loc) · 1.91 KB
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
name: Build
on:
push:
branches:
- main
workflow_dispatch:
env:
APP_NAME: 'Hello'
SRC_PATH: 'src'
OUTPUT_PATH: 'output'
DEPLOY_PATH: 'deploy'
DOTNET_VERSION: '7.0.x'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore
run: dotnet restore ${{ env.SRC_PATH }}/Hello.sln
- name: Build
run: dotnet build ${{ env.SRC_PATH }}/Hello.sln --configuration Release --no-restore
- name: Publish
run: dotnet publish ${{ env.SRC_PATH }}/Hello/Hello.csproj --no-build --no-restore --configuration Release --output ${{ env.OUTPUT_PATH }}
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Provision Resource Group
run: |
if [ $(az group exists --name "${{ env.APP_NAME }}-WUS") = false ]; then
az group create --name "${{ env.APP_NAME }}-WUS" --location "West US"
fi
- name: Provision Resources
id: deploy
uses: azure/arm-deploy@v1
with:
template: ${{ env.DEPLOY_PATH }}/azuredeploy.json
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }}
resourceGroupName: "${{ env.APP_NAME }}-WUS"
deploymentName: hello-1.0.${{github.run_number}}
- name: Deploy
uses: azure/webapps-deploy@v2
id: fa
with:
app-name: ${{steps.deploy.outputs.siteName}}
slot-name: 'Production'
package: '${{ env.OUTPUT_PATH }}'
- name: Test
run: dotnet test ${{ env.SRC_PATH }}/Hello.sln --configuration Release --no-build --no-restore
env:
WEBAPP_URL: "https://${{steps.deploy.outputs.url}}"