Skip to content

build(deps): bump actions/setup-dotnet from 4 to 5 #21

build(deps): bump actions/setup-dotnet from 4 to 5

build(deps): bump actions/setup-dotnet from 4 to 5 #21

Workflow file for this run

name: Deploy to Dev
on:
push:
branches: [main]
paths:
- 'src/**'
- 'infra/**'
- '.github/workflows/deploy-dev.yml'
workflow_dispatch:
inputs:
skip_tests:
description: 'Skip tests before deployment'
type: boolean
default: false
env:
DOTNET_VERSION: '10.0.x'
NODE_VERSION: '22'
AZURE_RESOURCE_GROUP: clarissabot-rg
AZURE_LOCATION: eastus
ENVIRONMENT: dev
BASE_NAME: clarissabot
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
if: ${{ !inputs.skip_tests }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Test
run: dotnet test src/ClarissaBot.sln --configuration Release --verbosity normal
build-and-push:
name: Build & Push Images
runs-on: ubuntu-latest
needs: [test]
if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped')
outputs:
api-image: ${{ steps.meta-api.outputs.tags }}
web-image: ${{ steps.meta-web.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Get ACR credentials
id: acr
run: |
ACR_NAME=$(az acr list --resource-group ${{ env.AZURE_RESOURCE_GROUP }} --query "[0].name" -o tsv)
ACR_LOGIN_SERVER=$(az acr show --name $ACR_NAME --query "loginServer" -o tsv)
echo "name=$ACR_NAME" >> $GITHUB_OUTPUT
echo "login-server=$ACR_LOGIN_SERVER" >> $GITHUB_OUTPUT
- name: Login to ACR
uses: azure/docker-login@v2
with:
login-server: ${{ steps.acr.outputs.login-server }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta (API)
id: meta-api
uses: docker/metadata-action@v5
with:
images: ${{ steps.acr.outputs.login-server }}/clarissabot-api
tags: |
type=sha,prefix=
type=raw,value=latest
- name: Build and push API
uses: docker/build-push-action@v6
with:
context: src/ClarissaBot
file: src/ClarissaBot/ClarissaBot.Api/Dockerfile
push: true
tags: ${{ steps.meta-api.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Docker meta (Web)
id: meta-web
uses: docker/metadata-action@v5
with:
images: ${{ steps.acr.outputs.login-server }}/clarissabot-web
tags: |
type=sha,prefix=
type=raw,value=latest
- name: Build and push Web
uses: docker/build-push-action@v6
with:
context: src/ClarissaBot.Web
file: src/ClarissaBot.Web/Dockerfile
push: true
tags: ${{ steps.meta-web.outputs.tags }}
cache-from: type=gha,scope=web
cache-to: type=gha,mode=max,scope=web
build-args: |
VITE_API_URL=${{ secrets.DEV_API_URL }}
deploy:
name: Deploy to Dev
runs-on: ubuntu-latest
needs: [build-and-push]
environment: dev
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Get deployment info
id: info
run: |
ACR_NAME=$(az acr list --resource-group ${{ env.AZURE_RESOURCE_GROUP }} --query "[0].name" -o tsv)
ACR_LOGIN_SERVER=$(az acr show --name $ACR_NAME --query "loginServer" -o tsv)
ACR_PASSWORD=$(az acr credential show --name $ACR_NAME --query "passwords[0].value" -o tsv)
OPENAI_ENDPOINT=$(az cognitiveservices account show \
--name ${{ secrets.OPENAI_ACCOUNT_NAME }} \
--resource-group ${{ secrets.OPENAI_RESOURCE_GROUP }} \
--query "properties.endpoint" -o tsv)
echo "acr-name=$ACR_NAME" >> $GITHUB_OUTPUT
echo "acr-login-server=$ACR_LOGIN_SERVER" >> $GITHUB_OUTPUT
echo "acr-password=$ACR_PASSWORD" >> $GITHUB_OUTPUT
echo "openai-endpoint=$OPENAI_ENDPOINT" >> $GITHUB_OUTPUT
- name: Deploy infrastructure
uses: azure/arm-deploy@v2
with:
resourceGroupName: ${{ env.AZURE_RESOURCE_GROUP }}
template: infra/main.bicep
failOnStdErr: false
parameters: >
baseName=${{ env.BASE_NAME }}
location=${{ env.AZURE_LOCATION }}
environment=${{ env.ENVIRONMENT }}
azureOpenAIEndpoint=${{ steps.info.outputs.openai-endpoint }}
azureOpenAIDeploymentName=${{ secrets.OPENAI_DEPLOYMENT_NAME }}
apiImage=${{ steps.info.outputs.acr-login-server }}/clarissabot-api:latest
webImage=${{ steps.info.outputs.acr-login-server }}/clarissabot-web:latest
registryPassword=${{ steps.info.outputs.acr-password }}
apiKey=${{ secrets.API_KEY }}