1
- name : .NET CI
1
+ name : .NET CI/CD
2
2
3
- env :
4
- registryName : mpplabajep.azurecr.io
5
- repositoryName : techexcel/dotnetcoreapp
6
- dockerFolderPath : ./src/Application/src/RazorPagesTestSample
7
- tag : ${{github.run_number}}
8
-
9
3
on :
10
4
push :
11
5
branches : [ main ]
12
- paths : src/Application/**
6
+ paths :
7
+ - src/Application/**
13
8
pull_request :
14
9
branches : [ main ]
15
- paths : src/Application/**
10
+ paths :
11
+ - src/Application/**
16
12
# Allows you to run this workflow manually from the Actions tab
17
13
workflow_dispatch :
14
+
18
15
jobs :
19
16
build :
20
-
21
17
runs-on : ubuntu-latest
22
18
23
19
steps :
24
20
- uses : actions/checkout@v3
25
21
- name : Setup .NET
26
22
uses : actions/setup-dotnet@v3
27
23
with :
28
- dotnet-version : 8.0
29
-
24
+ dotnet-version : ' 8.0.x '
25
+
30
26
- name : Restore dependencies
31
- run : dotnet restore ./ src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
27
+ run : dotnet restore src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
32
28
- name : Build
33
- run : dotnet build --no-restore ./ src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
29
+ run : dotnet build --no-restore src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
34
30
- name : Test
35
- run : dotnet test --no-build --verbosity normal ./src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
36
-
37
- dockerBuildPush :
38
-
39
- runs-on : ubuntu-latest
40
- needs : build
41
-
42
- steps :
43
- - uses : actions/checkout@v3
44
-
45
- - name : Docker Login
46
- # You may pin to the exact commit or the version.
47
- # uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
48
-
49
- with :
50
- # Server address of Docker registry. If not set then will default to Docker Hub
51
- registry : ${{ secrets.ACR_LOGIN_SERVER }}
52
- # Username used to log against the Docker registry
53
- username : ${{ secrets.ACR_USERNAME }}
54
- # Password or personal access token used to log against the Docker registry
55
- password : ${{ secrets.ACR_PASSWORD }}
56
- # Log out from the Docker registry at the end of a job
57
- logout : true
58
-
59
- - name : Docker Build
60
- run : docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath
61
-
62
- - name : Docker Push
63
- run : docker push $registryName/$repositoryName:$tag
64
-
65
- deploy-to-dev :
66
-
67
- runs-on : ubuntu-latest
68
- needs : dockerBuildPush
69
- environment :
70
- name : dev
71
- url : https://mpplabajep-dev.azurewebsites.net/
72
-
73
- steps :
74
- - name : ' Login via Azure CLI'
75
-
76
- with :
77
- creds : ${{ secrets.AZURE_CREDENTIALS }}
78
-
79
- - uses : azure/webapps-deploy@v2
80
- with :
81
- app-name : ' mpplabajep-dev'
82
- images : mpplabajep.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
31
+ run : dotnet test --no-build --verbosity normal src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
83
32
84
33
deploy-to-test :
85
-
86
34
runs-on : ubuntu-latest
87
- needs : deploy-to-dev
35
+ needs : build
88
36
environment :
89
37
name : test
90
38
url : https://mpplabajep-test.azurewebsites.net/
91
-
39
+
92
40
steps :
93
41
- uses : actions/checkout@v3
94
42
@@ -103,13 +51,12 @@ jobs:
103
51
images : mpplabajep.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
104
52
105
53
deploy-to-prod :
106
-
107
54
runs-on : ubuntu-latest
108
55
needs : deploy-to-test
109
56
environment :
110
57
name : prod
111
58
url : https://mpplabajep-prod.azurewebsites.net/
112
-
59
+
113
60
steps :
114
61
- uses : actions/checkout@v3
115
62
0 commit comments