File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Expand file tree Collapse file tree 1 file changed +64
-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
You can’t perform that action at this time.
0 commit comments