Skip to content

Deploy Chat App

Deploy Chat App #33

name: Chat - Publish Docker Image
on:
push:
tags:
- "release-chat-v*.*.*"
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
env:
MSSQL_SA_PASSWORD: 6efe173b-3e33-4d6c-8f50-3e5f7cadd54c
TEST_DIRECTORY: tests/container_apps/Jordnaer.Chat.Tests
services:
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
SA_PASSWORD: "${{ env.MSSQL_SA_PASSWORD }}"
ACCEPT_EULA: 'Y'
ports:
- 1433:1433
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.x'
- name: Test
run: dotnet test "${{ env.TEST_DIRECTORY }}" --filter Category!=ManualTest
env:
ConnectionStrings__AppConfig: ${{ secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING }}
ConnectionStrings__JordnaerDbContext: "Server=localhost,1433;Database=jordnaer;User ID=sa;Password=${{ env.MSSQL_SA_PASSWORD }};Persist Security Info=False;TrustServerCertificate=true;"
push:
if: |
always() &&
(needs.test.result == 'success' || needs.test.result == 'skipped')
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.CHAT_AZURE_CREDENTIALS }}
- name: Deploy image to Azure Container Apps
uses: azure/container-apps-deploy-action@v1
with:
appSourcePath: ./src/container_apps/Jordnaer.Chat
registryUrl: ghcr.io
registryUsername: ${{ github.repository_owner }}
registryPassword: ${{ secrets.GITHUB_TOKEN }}
containerAppName: chat
resourceGroup: Jordnaer
imageToBuild: ghcr.io/nielspilgaard/chat:${{ github.sha }}
dockerfilePath: Dockerfile