-
Notifications
You must be signed in to change notification settings - Fork 293
34 lines (30 loc) · 1.88 KB
/
petstoreassistant_ci_cd_to_appservice.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Pet Store Assistant CI/CD to Azure App Service
env:
AZURE_CONTAINER_REGISTRY: azurepetstoremecr.azurecr.io
AZURE_CONTAINER_REGISTRY_USERNAME: azurepetstoremecr
on:
push:
branches:
- main
paths:
- petstore/petstoreassistant/**
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update the application.properties hack because the app config injection isnt working for some reason
run: echo -n -e "MicrosoftAppId=${{ secrets.ASSISTANTAPPID }}\nMicrosoftAppPassword=${{ secrets.ASSISTANTAPPPASSWORD }}\nserver.port=3978\napim.key=${{ secrets.ASSISTANT_APIM_KEY }}\naoai.key=${{ secrets.ASSISTANT_AOAI_KEY }}\naoai.url=https://azurepetstoremeapim.azure-api.net\ncognitive.search.key=${{ secrets.ASSISTANT_CS_KEY }}\ncognitive.search.url=https://azurepetstoreaisearch.search.windows.net/indexes/azurepetstore-cosmosdb-products-index/docs/search?api-version=2024-07-01\ncosmos.key=${{ secrets.ASSISTANT_COSMOS_KEY }}\nsubscriptionId=${{ secrets.SUBSCRIPTION_ID }}" > petstore/petstoreassistant/src/main/resources/application.properties
- run: cat petstore/petstoreassistant/src/main/resources/application.properties
- uses: azure/docker-login@v1
name: Build Docker image
with:
login-server: ${{ env.AZURE_CONTAINER_REGISTRY }}
username: ${{ env.AZURE_CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.PETSTORECRSECRET }}
- name: Push Docker image to Azure Container Registry
run: |
docker build petstore/petstoreassistant -t ${{env.AZURE_CONTAINER_REGISTRY}}/petstoreassistant:latest -t ${{ env.AZURE_CONTAINER_REGISTRY }}/petstoreassistant:${{ github.sha }}
docker push ${{ env.AZURE_CONTAINER_REGISTRY }}/petstoreassistant:${{ github.sha }}
docker push ${{ env.AZURE_CONTAINER_REGISTRY }}/petstoreassistant:latest