Skip to content

Commit fa501b8

Browse files
committed
deploy 2
1 parent 94e73b1 commit fa501b8

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build and deploy .NET Core application to Web App SqlToElasticSearch
2+
on:
3+
push:
4+
branches:
5+
- master
6+
env:
7+
AZURE_WEBAPP_NAME: SqlToElasticSearch
8+
AZURE_WEBAPP_PACKAGE_PATH: .\published
9+
CONFIGURATION: Release
10+
DOTNET_CORE_VERSION: 9.0.x
11+
WORKING_DIRECTORY: .
12+
jobs:
13+
build:
14+
runs-on: windows-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Setup .NET SDK
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
21+
- name: Restore
22+
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
23+
- name: Build
24+
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
25+
- name: Test
26+
run: dotnet test "${{ env.WORKING_DIRECTORY }}" --no-build
27+
- name: Publish
28+
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
29+
- name: Publish Artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: webapp
33+
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
34+
deploy:
35+
runs-on: windows-latest
36+
needs: build
37+
steps:
38+
- name: Download artifact from build job
39+
uses: actions/download-artifact@v4
40+
with:
41+
name: webapp
42+
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
43+
- name: Azure Login
44+
uses: azure/login@v2
45+
with:
46+
creds: ${{ secrets.SqlToElasticSearch_SPN }}
47+
- name: Deploy to Azure WebApp
48+
uses: azure/webapps-deploy@v2
49+
with:
50+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
51+
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

0 commit comments

Comments
 (0)