Skip to content

Commit 606254c

Browse files
committed
Add GitHub Actions workflow for .NET Core Azure deployment
Introduce a GitHub Actions workflow to build and deploy the .NET Core application "MalfuzatExplorer" to an Azure Web App. The workflow is triggered by a push to the `master` branch and includes environment variable setup for the Azure Web App name, package path, build configuration, .NET Core version, and working directory. The workflow consists of two jobs: - `build`: Runs on the latest Windows environment, checks out the repository, sets up the .NET SDK, restores dependencies, builds the application, runs tests, publishes the application, and uploads the artifacts. - `deploy`: Depends on the `build` job, runs on the latest Windows environment, downloads the build artifacts, and deploys the application to the Azure Web App using a publish profile stored in GitHub Secrets.
1 parent 8238f46 commit 606254c

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and deploy .NET Core application to Web App MalfuzatExplorer
2+
on:
3+
push:
4+
branches:
5+
- master
6+
env:
7+
AZURE_WEBAPP_NAME: MalfuzatExplorer
8+
AZURE_WEBAPP_PACKAGE_PATH: .\published
9+
CONFIGURATION: Release
10+
DOTNET_CORE_VERSION: 8.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@v3
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@v3
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@v3
40+
with:
41+
name: webapp
42+
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
43+
- name: Deploy to Azure WebApp
44+
uses: azure/webapps-deploy@v2
45+
with:
46+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
47+
publish-profile: ${{ secrets.MalfuzatExplorer_FBE0 }}
48+
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

0 commit comments

Comments
 (0)