A programming framework for agentic AI
[Marketing] Github pipelines to build and deploy the project (#65)
Carlos Garcia Lalicata71ed485d5b4b
diff --git a/.github/workflows/marketing-build.yml b/.github/workflows/marketing-build.ymlnew file mode 100644index 000000000..a4e530f03--- /dev/null+++ b/.github/workflows/marketing-build.yml@@ -0,0 +1,29 @@+run-name: '[PR #${{github.event.pull_request.number}}] [Marketing Sample] Build frontend and backend containers'+++on:+ workflow_dispatch:+ push:+ branches:+ - main+ pull_request:+ branches:+ - '**'++jobs:+ build:+ runs-on: ubuntu-latest+ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - name: Build the backend+ run: |+ docker build -t marketing-backend -f samples/marketing/src/backend/Dockerfile .+ shell: pwsh++ - name: Build the frontend+ run: |+ cd samples/marketing/src/frontend/+ docker build -t marketing-frontend .+ shell: pwsh\ No newline at end of filediff --git a/.github/workflows/marketing-builddeploy.yml b/.github/workflows/marketing-builddeploy.ymlnew file mode 100644index 000000000..a05b27b42--- /dev/null+++ b/.github/workflows/marketing-builddeploy.yml@@ -0,0 +1,98 @@+# GitHub Actions workflow to deploy to Azure using azd+# To configure required secrets for connecting to Azure, simply run `azd pipeline config`+# 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++# This workflow needs Owner rights on the Azure Subscription:+# $assignee = "<Enterprise_App_Object_ID>"+# $scope = "/subscriptions/<Subscription_ID>+# az role assignment create --assignee $assignee --role "Owner" --scope $scope++run-name: '[PR #${{github.event.pull_request.number}}] [Marketing Sample] - Build and Deploy frontend and backend'++on:+ workflow_dispatch:+ inputs:+ azdnostate:+ type: choice+ description: azd --no-state flag+ options:+ - 'false'+ - 'true'+ push:+ branches:+ - main+ paths:+ - samples/marketing/*+ pull_request:+ branches:+ - 'main'++permissions:+ id-token: write+ contents: read++defaults:+ run:+ shell: pwsh+ working-directory: ./samples/marketing++jobs:+ build:+ runs-on: ubuntu-latest+ env:+ AZURE_SUBSCRIPTION_ID: ${{ secrets.MARKETING_AZURE_SUBSCRIPTION_ID }}+ AZURE_ENV_NAME: ${{ secrets.MARKETING_AZURE_ENV_NAME }}+ AZURE_LOCATION: ${{ secrets.MARKETING_AZURE_LOCATION }}+ AZURE_TENANT_ID: ${{ secrets.MARKETING_AZURE_TENANT_ID }}+ AZURE_CLIENT_ID: ${{ secrets.MARKETING_AZURE_CLIENT_ID }}+ # AZURE_CREDENTIALS: ${{ secrets.MARKETING_AZURE_CREDENTIALS }}+ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - name: Install azd+ uses: Azure/[email protected]++ # https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Cwindows#use-the-azure-login-action-with-openid-connect+ - name: Log in with Azure (Federated Credentials)+ if: ${{ env.AZURE_CLIENT_ID != '' }}+ run: |+ azd auth login `+ --client-id "$Env:AZURE_CLIENT_ID" `+ --federated-credential-provider "github" `+ --tenant-id "$Env:AZURE_TENANT_ID"++ # - name: Log in with Azure (Client Credentials)+ # if: ${{ env.AZURE_CREDENTIALS != '' }}+ # run: |+ # $info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;+ # Write-Host "::add-mask::$($info.clientSecret)"+ # azd auth login `+ # --client-id "$($info.clientId)" `+ # --client-secret "$($info.clientSecret)" `+ # --tenant-id "$($info.tenantId)"+ # shell: pwsh+ # env:+ # AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}++ - name: Set --no-state flag for azd+ id: no-state+ run: |+ if ("${{ github.event.inputs.azdnostate }}" -eq "true") {+ echo "::set-output name=azd-no-state-flag::--no-state"+ Write-Warning "Using --no-state flag for azd provision"+ } else {+ Write-Verbose "No --no-state flag for azd provision" -Verbose+ echo "::set-output name=azd-no-state-flag::"+ }++ - name: Provision Infrastructure+ run: |+ azd provision `+ --no-prompt `+ --environment ${{ secrets.MARKETING_AZURE_ENV_NAME }} `+ ${{ steps.no-state.outputs.azd-no-state-flag }}++ - name: Deploy Application+ run: azd deploy --no-prompt --environment ${{ secrets.MARKETING_AZURE_ENV_NAME }}\ No newline at end of filediff --git a/samples/marketing/azure.yaml b/samples/marketing/azure.yamlindex 9399c365d..5f5888574 100644--- a/samples/marketing/azure.yaml+++ b/samples/marketing/azure.yaml@@ -5,14 +5,14 @@ metadata:template: [email protected]services:backend:- project: src\backend+ project: "src/backend"host: containerapplanguage: dotnetdocker:path: Dockerfilecontext: ../../../../frontend:- project: src\frontend+ project: "src/frontend"host: containerapplanguage: tsdist: build