From 4f26d461fe0a20ad2231658e2f04c4fce94a6f54 Mon Sep 17 00:00:00 2001 From: Dave Thaler Date: Sun, 9 Jun 2024 20:59:25 -0700 Subject: [PATCH] Update deployment workflows (#35) Fixes #33 Signed-off-by: Dave Thaler --- .github/workflows/publish.yml | 2 +- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 89dde93..2316e67 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,7 +4,7 @@ on: branches: - main env: - AZURE_WEBAPP_NAME: OrcanodeMonitor + AZURE_WEBAPP_NAME: OrcanodeMonitorStaging AZURE_WEBAPP_PACKAGE_PATH: OrcanodeMonitor\published CONFIGURATION: Release DOTNET_CORE_VERSION: 8.0.x diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ab6ae30 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Build and deploy .NET Core application to Web App OrcanodeMonitor +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' +env: + AZURE_WEBAPP_NAME: OrcanodeMonitor + AZURE_WEBAPP_PACKAGE_PATH: OrcanodeMonitor\published + CONFIGURATION: Release + DOTNET_CORE_VERSION: 8.0.x + WORKING_DIRECTORY: OrcanodeMonitor +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.OrcanodeMonitorPublishProfile }} + package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}