Adds Azure secrets for deployment
This commit is contained in:
39
.github/workflows/backend-ci.yml
vendored
39
.github/workflows/backend-ci.yml
vendored
@@ -2,33 +2,40 @@ name: Backend CI/CD
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
AZURE_WEBAPP_NAME: hutopy-backend-api
|
||||||
|
AZURE_WEBAPP_PACKAGE_PATH: '.'
|
||||||
|
DOTNET_VERSION: '8.0.x'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_deploy:
|
build_and_deploy:
|
||||||
runs-on: windows-latest
|
runs-on: ubuntu-latest
|
||||||
|
environment: dev
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
# Checkout the repository
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Setup .NET
|
|
||||||
|
# Setup .NET Core
|
||||||
|
- name: Setup .NET Core
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: '8.0.x'
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||||
- name: Restore dependencies
|
|
||||||
|
# Run dotnet build and publish
|
||||||
|
- name: dotnet build and publish
|
||||||
run: |
|
run: |
|
||||||
cd backend
|
|
||||||
dotnet restore
|
dotnet restore
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
cd backend
|
|
||||||
dotnet build --configuration Release
|
dotnet build --configuration Release
|
||||||
- name: Publish
|
dotnet publish --configuration Release --output '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/backend-app'
|
||||||
run: |
|
|
||||||
cd backend
|
# Deploy to Azure WebApp
|
||||||
dotnet publish --configuration Release --output ./publish
|
|
||||||
- name: Deploy to Azure WebApp
|
- name: Deploy to Azure WebApp
|
||||||
uses: azure/webapps-deploy@v2
|
uses: azure/webapps-deploy@v2
|
||||||
with:
|
with:
|
||||||
app-name: "<YOUR_APP_SERVICE_NAME>"
|
app-name: ${{ env.AZURE_WEBAPP_NAME }}
|
||||||
slot-name: "production" # if using deployment slots
|
|
||||||
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
|
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
|
||||||
package: ./backend/publish
|
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/backend-app'
|
||||||
|
|||||||
Reference in New Issue
Block a user