Skip to content

[API] Facilitate JSON log formatting lost due to using CreateSlimBuilder #58

[API] Facilitate JSON log formatting lost due to using CreateSlimBuilder

[API] Facilitate JSON log formatting lost due to using CreateSlimBuilder #58

name: API – Build and Deploy
on:
push:
branches:
- prime
paths:
- api/**
- .github/workflows/api-build-and-deploy.yml
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build Job
steps:
- name: Validate Branch
id: validatebranch
run: |
[ $GITHUB_REF = refs/heads/prime ] || (echo 'Workflow must be run on branch “prime”!' && exit 1)
- name: Checkout
id: checkout
uses: actions/checkout@v3
- name: Test
id: test
run: dotnet test
working-directory: api
- name: Build
id: build
run: |
dotnet publish Sammo.Oeis.Api -c Release \
-p:PublishProfile=DefaultContainer -p:ContainerImageName=tmp -p:ContainerImageTags=$GITHUB_SHA
working-directory: api
- name: Login to GitHub Packages
id: dockerlogin
uses: docker/login-action@v2
with:
registry: ghcr.io
username: burkenyo
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Packages
id: dockerpush
run: |
docker tag tmp:$GITHUB_SHA ghcr.io/burkenyo/sammo-ga-api:$GITHUB_SHA
docker push ghcr.io/burkenyo/sammo-ga-api:$GITHUB_SHA
deploy:
runs-on: ubuntu-latest
name: Deployment Job
needs: build
steps:
- name: Login to Azure
id: azurelogin
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_AD_APP_IDENTITY_CREDENTIALS }}
- name: Deploy to Azure Container Apps
id: azuredeploy
run: |
az extension add -n containerapp
az containerapp update -n sammo-ga -g orangewave.io --image ghcr.io/burkenyo/sammo-ga-api:$GITHUB_SHA