-
Notifications
You must be signed in to change notification settings - Fork 3
197 lines (168 loc) · 6.94 KB
/
SSW.SophieBot.dev.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Build and Deploy-Dev
on:
push:
branches:
- main
paths:
- "bots/**"
- "libraries/**"
- "services/**"
- ".github/workflows/SSW.SophieBot.dev.yml"
- ".github/workflows/scripts/**"
workflow_dispatch:
concurrency:
group: SSWSophieBotDev-BuildAndDeploy
cancel-in-progress: true
env:
BUILD_FLOW: composer
BOT_NAME: SSWSophieBotDev
WEBAPP_NAME: SSWSophieBotDev
SOURCE_DIR: ${{ github.workspace }}
OUTPUT_DIR: ${{ github.workspace }}/output
LUIS_MIGRATOR_DIR: ${{ github.workspace }}/bots/employee-finder/src/SSW.SophieBot.LUIS.EmployeeFinder.Migrator
BOT_PROJECT_DIR: ${{ github.workspace }}/bots/employee-finder/src/SSW.SophieBot
BOT_PROJECT_NAME: SSW.SophieBot.csproj
PUBLISHING_PROFILE_NAME: SSW.Bots.Dev
LUIS_AUTHORING_ENDPOINT: https://australiaeast.api.cognitive.microsoft.com/
LUIS_AUTHORING_REGION: australiaeast
defaults:
run:
shell: pwsh
jobs:
build:
name: Build
runs-on: ubuntu-latest
environment: dev
steps:
- uses: actions/checkout@v4
- name: Use Node 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Use BF CLI
run: npm install -g @microsoft/botframework-cli
- name: Use .Net sdk 6.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: "6.0.x"
- name: Create appsettings file
uses: jsdaniell/[email protected]
with:
name: "appsettings.json"
json: ${{ secrets.BOT_APP_APPSETTINGS }}
dir: "bots/employee-finder/src/SSW.SophieBot/settings"
# Prepare working folders
- name: Prepare working folders
if: env.BUILD_FLOW == 'composer'
run: |
$generatedDirectory = "${{ env.BOT_PROJECT_DIR }}/generated"
# Clean and recreate the generated directory
if (Test-Path $generatedDirectory)
{
Remove-Item -Path $generatedDirectory -Force -Recurse
}
$outputDirectory = "$generatedDirectory/interruption"
New-Item -Path /. -name $outputDirectory -ItemType "directory"
# Cross train LU models
- name: Cross train LU models
if: env.BUILD_FLOW == 'composer'
run: |
$sourceDirectory = "${{ env.BOT_PROJECT_DIR }}"
$outputDirectory = "${{ env.BOT_PROJECT_DIR }}/generated/interruption"
# Cross train models
bf luis:cross-train --in $sourceDirectory --out $outputDirectory --config $sourceDirectory/settings/cross-train.config.json --force
# List generated files
cd $outputDirectory
ls -R
# Publish LUIS models
- name: Publish LUIS
if: env.BUILD_FLOW == 'composer'
run: ${{ env.SOURCE_DIR }}/.github/workflows/scripts/Build-LUIS.ps1 -outputDirectory ./generated -sourceDirectory ./ -crossTrainedLUDirectory ./generated/interruption -authoringKey ${{ secrets.LUIS_AUTHORING_KEY }} -botName ${{ env.BOT_NAME }} -endpoint ${{ env.LUIS_AUTHORING_ENDPOINT }} -region ${{ env.LUIS_AUTHORING_REGION }}
working-directory: ${{ env.BOT_PROJECT_DIR }}
# Publish QnA models
- name: Publish QnA
if: env.BUILD_FLOW == 'composer'
run: |
$publishingProfileName = (${{ env.BUILD_FLOW }} -eq 'composer') ? "${{ env.PUBLISHING_PROFILE_NAME }}" : ""
${{ env.SOURCE_DIR }}/.github/workflows/scripts/Build-QnA.ps1 -botProjectFolder ./ -crossTrainedLUDirectory ./generated/interruption -publishingProfile $publishingProfileName
working-directory: ${{ env.BOT_PROJECT_DIR }}
# Publish Orchestrator models
# - name: Publish orchestrator
# if: env.BUILD_FLOW == 'composer'
# run: |
# cd ${{ env.BOT_PROJECT_DIR }}
# & "${{ env.SOURCE_DIR }}/.github/workflows/scripts/Build-Orchestrator.ps1" -outputDirectory ./generated -sourceDirectory ./ -crossTrainedLUDirectory ./generated/interruption -appSettingsFile ./settings/appsettings.json
# Upload bot models artifact
- name: Upload bot models artifact
if: env.BUILD_FLOW == 'composer'
uses: actions/upload-artifact@v4
with:
name: "Bot_Models_${{ github.run_id }}"
path: ${{ env.BOT_PROJECT_DIR }}/generated
if-no-files-found: error
# Create bot app publishing package
- name: Create bot publishing package
run: |
$publishingProfileName = (${{ env.BUILD_FLOW }} -eq 'composer') ? "${{ env.PUBLISHING_PROFILE_NAME }}" : ""
& "${{ env.SOURCE_DIR }}/.github/workflows/scripts/Publish-WebApp.ps1" -botProjectFolder ${{ env.BOT_PROJECT_DIR }} -botProjectName ${{ env.BOT_PROJECT_NAME }} -outputFolder "${{ env.OUTPUT_DIR }}/deploy" -publishingProfile $publishingProfileName
working-directory: ${{ env.BOT_PROJECT_DIR }}
# Create LUIS migrator publishing package
- name: Create LUIS migrator publishing package
run: dotnet publish -c Release -o "${{ env.OUTPUT_DIR }}/luis-migrator" --self-contained -r win-x64
working-directory: ${{ env.LUIS_MIGRATOR_DIR }}
# Upload webapp artifact
- name: Upload webapp artifact
uses: actions/upload-artifact@v4
with:
name: "Bot_Webapp_${{ github.run_id }}"
path: ${{ env.OUTPUT_DIR }}/deploy
if-no-files-found: error
# Upload LUIS migrator artifact
- name: Upload LUIS migrator artifact
uses: actions/upload-artifact@v4
with:
name: "LUIS_Migrator_${{ github.run_id }}"
path: ${{ env.OUTPUT_DIR }}/luis-migrator
if-no-files-found: error
deploy-web-app:
name: Deploy web app
needs: build
runs-on: ubuntu-latest
environment: dev
steps:
- uses: actions/[email protected]
- name: Use .Net sdk 6.0.x
uses: actions/[email protected]
with:
dotnet-version: "6.0.x"
- uses: actions/download-artifact@v4
with:
name: "Bot_Webapp_${{ github.run_id }}"
path: ${{ env.OUTPUT_DIR }}/deploy
# Deploy the web app to azure
- name: "Deploy Azure Web App"
uses: Azure/webapps-deploy@v2
with:
app-Name: ${{ env.WEBAPP_NAME }}
publish-profile: ${{ secrets.BOT_WEBAPP_PUBLISH_PROFILE }}
package: "${{ env.OUTPUT_DIR }}/deploy"
migrate-luis-model:
name: Migrate LUIS model
needs: build
runs-on: windows-latest
environment: dev
steps:
- uses: actions/[email protected]
- uses: actions/download-artifact@v4
with:
name: "LUIS_Migrator_${{ github.run_id }}"
path: ${{ env.OUTPUT_DIR }}/luis-migrator
- name: Create appsettings file
uses: jsdaniell/[email protected]
with:
name: "appsettings.json"
json: ${{ secrets.LUIS_MIGRATOR_APPSETTINGS }}
dir: "output/luis-migrator"
- name: Run LUIS migrator
run: .\SSW.SophieBot.LUIS.EmployeeFinder.Migrator
working-directory: ${{ env.OUTPUT_DIR }}/luis-migrator