Skip to content

(DEV) Deploy Backend #38

(DEV) Deploy Backend

(DEV) Deploy Backend #38

name: .NET Core CI
on:
push:
paths:
- backend/**
branches:
- main
workflow_dispatch:
env:
AZURE_WEBAPP_NAME: vibes-backend-dev # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: './backend' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '7.x.x' # set this to the dot net version to use
jobs:
build-backend-and-deploy:
runs-on: ubuntu-latest
environment: Development
steps:
# Checkout the repo
- uses: actions/checkout@main
# Setup .NET Core SDK
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
# Run dotnet build and publish
- name: dotnet build and publish
working-directory: backend/
run: |
dotnet restore
dotnet build --configuration Release
dotnet publish -c Release --property:PublishDir='${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/build'
# Deploy to Azure Web apps
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_BACKEND }} # Define secret variable in repository settings as per action documentation
package: 'backend/${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/build'