42 lines
1.0 KiB
YAML
42 lines
1.0 KiB
YAML
name: Backend CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
AZURE_WEBAPP_NAME: hutopy-backend-api
|
|
AZURE_WEBAPP_PACKAGE_PATH: '.'
|
|
DOTNET_VERSION: '8.0.x'
|
|
|
|
jobs:
|
|
build_and_deploy:
|
|
runs-on: ubuntu-latest
|
|
environment: dev
|
|
steps:
|
|
|
|
# Checkout the repository
|
|
- uses: actions/checkout@v2
|
|
|
|
# Setup .NET Core
|
|
- 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
|
|
run: |
|
|
dotnet restore
|
|
dotnet build --configuration Release
|
|
dotnet publish --configuration Release --output '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/backend-app'
|
|
|
|
# Deploy to Azure WebApp
|
|
- name: Deploy to Azure WebApp
|
|
uses: azure/webapps-deploy@v2
|
|
with:
|
|
app-name: ${{ env.AZURE_WEBAPP_NAME }}
|
|
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
|
|
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/backend-app'
|