Skip to content

Commit

Permalink
Add GitHub Actions workflow for .NET Core Azure deployment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
intisor committed Oct 3, 2024
1 parent 8238f46 commit 606254c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/MalfuzatExplorer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and deploy .NET Core application to Web App MalfuzatExplorer
on:
push:
branches:
- master
env:
AZURE_WEBAPP_NAME: MalfuzatExplorer
AZURE_WEBAPP_PACKAGE_PATH: .\published
CONFIGURATION: Release
DOTNET_CORE_VERSION: 8.0.x
WORKING_DIRECTORY: .
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
- name: Restore
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
- name: Build
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Test
run: dotnet test "${{ env.WORKING_DIRECTORY }}" --no-build
- name: Publish
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: webapp
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
deploy:
runs-on: windows-latest
needs: build
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: webapp
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.MalfuzatExplorer_FBE0 }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

0 comments on commit 606254c

Please sign in to comment.