diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml index e33e860..1f01a20 100644 --- a/.github/workflows/post-merge.yml +++ b/.github/workflows/post-merge.yml @@ -181,3 +181,33 @@ jobs: if: steps.semantic.outputs.new_release_published == 'true' run: echo "image_sha256=$(docker image inspect -f '{{index .RepoDigests 0}}' ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }})" >> "$GITHUB_ENV" + # + # Login to Azure. + # + - name: Login to Azure + uses: azure/login@8c334a195cbb38e46038007b304988d888bf676a #v2.0.0 + with: + client-id: ${{ secrets.AZURE_CD_IDENTITY_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_CD_IDENTITY_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + # + # RELEASE CANDIDATE - Update Container App + OpenAPI descriptor on APIM + # + - name: RELEASE CANDIDATE - Update Container App + OpenAPI descriptor on APIM + if: steps.semantic.outputs.new_release_published == 'true' + uses: azure/CLI@fa0f960f00db49b95fdb54328a767aee31e80105 + with: + inlineScript: | + API_DATA=$(az apim api show --resource-group ${{ secrets.AZURE_APIM_RESOURCE_GROUP }} --service-name ${{ secrets.AZURE_APIM_NAME }} --api-id ${{ secrets.AZURE_APIM_API_ID }} --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} --query "{path:path, serviceUrl:serviceUrl}") + API_PATH=$(echo $API_DATA | jq -r '.path') + API_SERVICE_URL=$(echo $API_DATA | jq -r '.serviceUrl') + az apim api import \ + --resource-group ${{ secrets.AZURE_APIM_RESOURCE_GROUP }} \ + --service-name ${{ secrets.AZURE_APIM_NAME }} \ + --api-id ${{ secrets.AZURE_APIM_API_ID }} \ + --specification-format OpenApi \ + --specification-path src/main/resources/META-INF/openapi.yaml \ + --path $API_PATH \ + --service-url $API_SERVICE_URL \ + --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} \ No newline at end of file