forked from microsoft/chat-copilot
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (66 loc) · 2.43 KB
/
copilot-deploy-backend.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: copilot-deploy-backend
on:
workflow_call:
inputs:
ARTIFACT_NAME:
required: true
type: string
ENVIRONMENT:
required: true
type: string
DEPLOYMENT_NAME:
required: true
type: string
outputs:
backend-host:
description: "Host to which backend is deployed"
value: ${{jobs.webapi.outputs.backend-host}}
permissions:
contents: read
id-token: write
jobs:
webapi:
environment: ${{inputs.ENVIRONMENT}}
strategy:
fail-fast: false
matrix:
include:
- { dotnet: "6.0", configuration: Release, os: ubuntu-latest }
# Map the job output to step output
outputs:
backend-host: ${{steps.app-name.outputs.backend-host}}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts
- uses: actions/download-artifact@v4
with:
name: ${{inputs.ARTIFACT_NAME}}
path: "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}"
- name: "Display downloaded content"
run: ls -R
working-directory: "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}"
- name: Azure login
uses: azure/login@v2
with:
client-id: ${{vars.AZURE_GITHUB_ACCESS_APP_ID}}
tenant-id: ${{vars.AZURE_GITHUB_ACCESS_TENANT_ID}}
subscription-id: ${{vars.AZURE_GITHUB_ACCESS_SUB_ID}}
enable-AzPSSession: false
- name: Get app name
id: app-name
run: |
WEB_APP_NAME=$(az deployment group show --name ${{inputs.DEPLOYMENT_NAME}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --output json | jq -r '.properties.outputs.webapiName.value')
echo "AZURE_WEBAPP_NAME=$WEB_APP_NAME" >> $GITHUB_ENV
echo "backend-host=$WEB_APP_NAME" >> $GITHUB_OUTPUT
- name: Enable Run From Package
uses: azure/CLI@v1
with:
azcliversion: 2.30.0
inlineScript: |
az webapp config appsettings set --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --name ${{ env.AZURE_WEBAPP_NAME }} --settings WEBSITE_RUN_FROM_PACKAGE="1" -o none
- name: "Deploy"
run: |
scripts/deploy/deploy-webapi.sh -p "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}/webapi.zip" -d ${{inputs.DEPLOYMENT_NAME}} -s ${{vars.AZURE_SUBSCRIPTION_ID}} -rg ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --skip-app-registration