Skip to content

Container Apps CI/CD pipeline #1

Container Apps CI/CD pipeline

Container Apps CI/CD pipeline #1

Workflow file for this run

name: Container Apps CI/CD pipeline
on:
push:
branches:
- main
paths:
- "app/**"
tags:
- v*.*.*
workflow_dispatch:
# Set up permissions for deploying with secretless Azure federated credentials
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
permissions:
id-token: write
contents: read
jobs:
changes-detection:
runs-on: ubuntu-latest
environment:
name: "Development"
outputs:
env-name: ${{steps.set-deploy-env.outputs.DEPLOY_ENVIRONMENT}}
build-banking-assistant: ${{ steps.changes.outputs.banking-assistant }}
build-frontend: ${{ steps.changes.outputs.frontend }}
build-account-api: ${{ steps.changes.outputs.account-api }}
build-payment-api: ${{ steps.changes.outputs.payment-api }}
build-transactions-api: ${{ steps.changes.outputs.transactions-api }}
aca-dev-env-name: ${{ vars.ACA_DEV_ENV_NAME }}
aca-accounts-app-name: ${{ vars.ACCOUNTS_ACA_DEV_APP_NAME }}
aca-transactions-app-name: ${{ vars.TRANSACTIONS_ACA_DEV_APP_NAME }}
aca-payments-app-name: ${{ vars.PAYMENTS_ACA_DEV_APP_NAME }}
aca-web-app-name: ${{ vars.WEB_ACA_DEV_APP_NAME }}
aca-copilot-app-name: ${{ vars.COPILOT_ACA_DEV_APP_NAME }}
steps:
- uses: actions/checkout@v2
- name: Filter Changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
banking-assistant:
- 'app/banking-assistant/**'
frontend:
- 'app/frontend/**'
account-api:
- 'app/business-api/account-api/**'
payment-api:
- 'app/business-api/payment-api/**'
transactions-api:
- 'app/business-api/transactions-api/**'
- name: Set environment for branch
id: set-deploy-env
run: |
echo "checking branch name [${{github.ref_name}}]"
if [[ ${{github.ref_name}} == 'main' ]]; then
echo "main branch detected. Set Development environment"
echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT"
elif [[ ${{github.ref_name}} == *'release'* ]]; then
echo "release branch detected. Set Test environment"
echo "DEPLOY_ENVIRONMENT=Test" >> "$GITHUB_OUTPUT"
elif [[ ${{github.ref_name}} == *'v'* ]]; then
echo "tag detected. Set Production environment"
echo "DEPLOY_ENVIRONMENT=Production" >> "$GITHUB_OUTPUT"
else
echo "branch not detected. Set Development environment as default"
echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT"
fi
build-account-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-account-api == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/account-api
app-folder-path: ./app/business-api/account-api
secrets: inherit
deploy-account-app:
needs: [changes-detection,build-account-app]
if: ${{ needs.changes-detection.outputs.build-account-api == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/account-api
container-app-env-name: ${{ needs.changes-detection.outputs.aca-dev-env-name }}
container-app-name: ${{ needs.changes-detection.outputs.aca-accounts-app-name }}
secrets: inherit
build-transactions-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-transactions-api == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/transactions-api
app-folder-path: ./app/business-api/transactions-api
secrets: inherit
deploy-transactions-app:
needs: [changes-detection,build-transactions-app]
if: ${{ needs.changes-detection.outputs.build-transactions-api == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/transactions-api
container-app-env-name: ${{ needs.changes-detection.outputs.aca-dev-env-name }}
container-app-name: ${{ needs.changes-detection.outputs.aca-transactions-app-name }}
secrets: inherit
build-payment-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-payment-api == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/payment-api
app-folder-path: ./app/business-api/payment-api
secrets: inherit
deploy-payment-app:
needs: [changes-detection,build-payment-app]
if: ${{ needs.changes-detection.outputs.build-payment-api == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/payment-api
container-app-env-name: ${{ needs.changes-detection.outputs.aca-dev-env-name }}
container-app-name: ${{ needs.changes-detection.outputs.aca-payments-app-name }}
secrets: inherit
build-frontend-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-frontend == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/web
app-folder-path: ./app/frontend
secrets: inherit
deploy-frontend-app:
needs: [changes-detection,build-frontend-app]
if: ${{ needs.changes-detection.outputs.build-frontend == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/web
container-app-env-name: ${{ needs.changes-detection.outputs.aca-dev-env-name }}
container-app-name: ${{ needs.changes-detection.outputs.aca-web-app-name }}
secrets: inherit
build-banking-assistant-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-banking-assistant == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/banking-assistant
app-folder-path: ./app/banking-assistant
secrets: inherit
deploy-banking-assistant-app:
needs: [changes-detection,build-banking-assistant-app]
if: ${{ needs.changes-detection.outputs.build-banking-assistant == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: agent-openai-banking-assistant-csharp/banking-assistant
container-app-env-name: ${{ needs.changes-detection.outputs.aca-dev-env-name }}
container-app-name: ${{ needs.changes-detection.outputs.aca-copilot-app-name }}
secrets: inherit