added image deployment key #52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and deploy sustineo-api | |
| on: | |
| push: | |
| branches: | |
| - release | |
| paths: | |
| - "api/**" | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| ROOT_NAME: sustineo | |
| jobs: | |
| build-and-deploy-api: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create tag | |
| run: | | |
| echo "TAG=v$(TZ='America/Los_Angeles' date +%Y%m%d.%H%M%S)" >> "$GITHUB_ENV" | |
| echo "Using tag: ${TAG}" | |
| - name: Log in to Azure | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: Log in to registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ secrets.REGISTRY_ENDPOINT }} | |
| username: ${{ secrets.REGISTRY_USERNAME }} | |
| password: ${{ secrets.REGISTRY_PASSWORD }} | |
| - name: Build and push container | |
| run: | | |
| cd api | |
| docker build . -t ${{ secrets.REGISTRY_ENDPOINT }}/$ROOT_NAME-api:latest --build-arg GIT_VERSION_TAG=${TAG} | |
| docker push ${{ secrets.REGISTRY_ENDPOINT }}/$ROOT_NAME-api:latest | |
| - name: Push Container | |
| run: | | |
| az containerapp up --name $ROOT_NAME-api \ | |
| --image ${{ secrets.REGISTRY_ENDPOINT }}/$ROOT_NAME-api:latest \ | |
| --ingress external \ | |
| --target-port 8000 \ | |
| --resource-group contoso-concierge \ | |
| --registry-server ${{ secrets.REGISTRY_ENDPOINT }} \ | |
| --registry-username ${{ secrets.REGISTRY_USERNAME }} \ | |
| --registry-password ${{ secrets.REGISTRY_PASSWORD }} \ | |
| --environment contoso-concierge-env \ | |
| --workload-profile-name heavy-workload \ | |
| --env-vars "APP_VERSION=${TAG}" \ | |
| "AZURE_OPENAI_ENDPOINT=secretref:azure-openai-endpoint" \ | |
| "AZURE_OPENAI_API_KEY=secretref:azure-openai-api-key" \ | |
| "AZURE_VOICE_ENDPOINT=secretref:azure-voice-endpoint" \ | |
| "AZURE_VOICE_KEY=secretref:azure-voice-key" \ | |
| "APPINSIGHTS_CONNECTIONSTRING=secretref:appinsights-connectionstring" \ | |
| "COSMOSDB_CONNECTION=secretref:cosmosdb-connection" \ | |
| "FOUNDRY_CONNECTION=secretref:foundry-connection" \ | |
| "AZURE_IMAGE_DEPLOYMENT=secretref:azure-image-deployment" \ | |
| "AZURE_IMAGE_ENDPOINT=secretref:azure-image-endpoint" \ | |
| "AZURE_IMAGE_API_KEY=secretref:azure-image-api-key" \ | |
| "SUSTINEO_STORAGE=secretref:sustineo-storage" \ | |
| "AZURE_SORA_ENDPOINT=secretref:azure-sora-endpoint" \ | |
| "AZURE_SORA_API_KEY=secretref:azure-sora-api-key" \ | |
| "BASE_URL=secretref:base-url" \ | |
| "LOCAL_TRACING_ENABLED=false" | |
| - name: Logout | |
| run: | | |
| az logout |