Adds Azure secrets for deployment

This commit is contained in:
2025-01-15 23:06:21 -05:00
parent 621b85912e
commit 59fce15148

View File

@@ -2,33 +2,40 @@ name: Backend CI/CD
on:
push:
branches: [ "main" ]
branches:
- main
env:
AZURE_WEBAPP_NAME: hutopy-backend-api
AZURE_WEBAPP_PACKAGE_PATH: '.'
DOTNET_VERSION: '8.0.x'
jobs:
build_and_deploy:
runs-on: windows-latest
runs-on: ubuntu-latest
environment: dev
steps:
# Checkout the repository
- uses: actions/checkout@v2
- name: Setup .NET
# Setup .NET Core
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
dotnet-version: ${{ env.DOTNET_VERSION }}
# Run dotnet build and publish
- name: dotnet build and publish
run: |
cd backend
dotnet restore
- name: Build
run: |
cd backend
dotnet build --configuration Release
- name: Publish
run: |
cd backend
dotnet publish --configuration Release --output ./publish
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: "<YOUR_APP_SERVICE_NAME>"
slot-name: "production" # if using deployment slots
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ./backend/publish
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/backend-app'