File tree Expand file tree Collapse file tree 2 files changed +88
-0
lines changed Expand file tree Collapse file tree 2 files changed +88
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy to Azure VM
2
+
3
+ env :
4
+ DOTNET_VERSION : ' 8'
5
+
6
+ on :
7
+ push :
8
+ branches : [ "main" ]
9
+ workflow_dispatch :
10
+
11
+ permissions :
12
+ contents : read
13
+
14
+ jobs :
15
+ build :
16
+ runs-on : windows-latest
17
+
18
+ steps :
19
+ - uses : actions/checkout@v4
20
+
21
+ - name : Set up .NET Core
22
+ uses : actions/setup-dotnet@v4
23
+ with :
24
+ dotnet-version : ${{ env.DOTNET_VERSION }}
25
+
26
+ - name : Set up dependency caching for faster builds
27
+ uses : actions/cache@v3
28
+ with :
29
+ path : ~/.nuget/packages
30
+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
31
+ restore-keys : |
32
+ ${{ runner.os }}-nuget-
33
+
34
+ - name : Build with dotnet
35
+ run : dotnet build --configuration Release
36
+
37
+ - name : dotnet publish
38
+ run : dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/pub
39
+
40
+ - name : Upload artifact for deployment job
41
+ uses : actions/upload-artifact@v3
42
+ with :
43
+ name : .net-app
44
+ path : ${{env.DOTNET_ROOT}}/pub
45
+
46
+ deploy :
47
+ permissions :
48
+ contents : none
49
+ runs-on : windows-latest
50
+ needs : build
51
+ steps :
52
+ - name : Download artifact from build job
53
+ uses : actions/download-artifact@v3
54
+ with :
55
+ name : .net-app
56
+ - name : Deploy to IIS
57
+ id : deploy-to-iis
58
+ uses : ChristopheLav/iis-deploy@v1
59
+ with :
60
+ website-name : ' api'
61
+ msdeploy-service-url : ${{ secrets.MSDEPLOY_URL }}
62
+ msdeploy-username : ${{ secrets.MSDEPLOY_USERNAME }}
63
+ msdeploy-password : ${{ secrets.MSDEPLOY_PASSWORD }}
64
+ source-path : ${{ github.workspace }}\website\publish
Original file line number Diff line number Diff line change
1
+ name : dotnet-CI
2
+
3
+ on :
4
+ push :
5
+ branches : [ "main" ]
6
+ pull_request :
7
+ branches : [ "main" ]
8
+
9
+ jobs :
10
+ build :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - uses : actions/checkout@v4
14
+ - name : Setup .NET
15
+ uses : actions/setup-dotnet@v4
16
+ with :
17
+ dotnet-version : 8.0.x
18
+ - name : Restore dependencies
19
+ run : dotnet restore
20
+ - name : Build
21
+ run : dotnet build --no-restore
22
+ - name : Test
23
+ run : dotnet test --no-build --verbosity normal
24
+
You can’t perform that action at this time.
0 commit comments