From 3a58f66a1257a5a11c91f3da1230693438c7b743 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 14:51:52 +1100 Subject: [PATCH 01/23] CI/CD - update the pipeline and make it work --- .github/workflows/SSW.SophieBot.dev.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 19722658..b8ef3417 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -1,6 +1,7 @@ name: Build and Deploy-Dev on: + workflow_dispatch: push: branches: - main @@ -27,6 +28,7 @@ env: PUBLISHING_PROFILE_NAME: SSW.Bots.Dev LUIS_AUTHORING_ENDPOINT: https://australiaeast.api.cognitive.microsoft.com/ LUIS_AUTHORING_REGION: australiaeast + BUILD_ENVIRONMENT: "${{env.GITHUB_EVENT_NAME == 'workflow_dispatch' && 'prod' || 'dev' }}" defaults: run: @@ -36,7 +38,7 @@ jobs: build: name: Build runs-on: ubuntu-latest - environment: dev + environment: ${{env.BUILD_ENVIRONMENT}} steps: - uses: actions/checkout@v2.3.4 @@ -149,7 +151,7 @@ jobs: name: Deploy web app needs: build runs-on: ubuntu-latest - environment: dev + environment: ${{env.BUILD_ENVIRONMENT}} steps: - uses: actions/checkout@v2.3.4 @@ -175,7 +177,7 @@ jobs: name: Migrate LUIS model needs: build runs-on: windows-latest - environment: dev + environment: ${{env.BUILD_ENVIRONMENT}} steps: - uses: actions/checkout@v2.3.4 From 5ec76f2d3df9c68362558d56f68976df0c4347b3 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 15:08:13 +1100 Subject: [PATCH 02/23] CI/CD: update the work flow to test --- .github/workflows/SSW.SophieBot.dev.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index b8ef3417..73d70bb8 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -1,10 +1,12 @@ name: Build and Deploy-Dev on: + workflow_dispatch: push: branches: - main + - 496-unify-workflow-v2 paths: - "bots/**" - "libraries/**" @@ -35,6 +37,12 @@ defaults: shell: pwsh jobs: + test-flow: + name: Test flow + runs-on: ubuntu-latest + steps: + - name: Test the build environment + run: echo "environment is $BUILD_ENVIRONMENT" build: name: Build runs-on: ubuntu-latest From 24b967c09806b3c4fdecee0fb626b266791e9976 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 15:17:26 +1100 Subject: [PATCH 03/23] CI/CD - update the work flow fix the bug --- .github/workflows/SSW.SophieBot.dev.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 73d70bb8..9b106f41 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -30,7 +30,7 @@ env: PUBLISHING_PROFILE_NAME: SSW.Bots.Dev LUIS_AUTHORING_ENDPOINT: https://australiaeast.api.cognitive.microsoft.com/ LUIS_AUTHORING_REGION: australiaeast - BUILD_ENVIRONMENT: "${{env.GITHUB_EVENT_NAME == 'workflow_dispatch' && 'prod' || 'dev' }}" + BUILD_ENVIRONMENT: "${{github.event_name == 'workflow_dispatch' && 'prod' || 'dev' }}" defaults: run: @@ -42,7 +42,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Test the build environment - run: echo "environment is $BUILD_ENVIRONMENT" + run: echo "environment is = " $BUILD_ENVIRONMENT + - run: echo "event is" ${{ github.event_name }} build: name: Build runs-on: ubuntu-latest From 53e6972ef655ca6dcaeeb75c294eca158ca74cdb Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 15:22:35 +1100 Subject: [PATCH 04/23] CI?CD get rid of the invalid environment --- .github/workflows/SSW.SophieBot.dev.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 9b106f41..25c6bb3f 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -47,7 +47,7 @@ jobs: build: name: Build runs-on: ubuntu-latest - environment: ${{env.BUILD_ENVIRONMENT}} + environment: $BUILD_ENVIRONMENT steps: - uses: actions/checkout@v2.3.4 @@ -160,7 +160,7 @@ jobs: name: Deploy web app needs: build runs-on: ubuntu-latest - environment: ${{env.BUILD_ENVIRONMENT}} + environment: $BUILD_ENVIRONMENT steps: - uses: actions/checkout@v2.3.4 @@ -186,7 +186,7 @@ jobs: name: Migrate LUIS model needs: build runs-on: windows-latest - environment: ${{env.BUILD_ENVIRONMENT}} + environment: $BUILD_ENVIRONMENT steps: - uses: actions/checkout@v2.3.4 From 9a2be7b563301a0a7fc52e4d819091cdb60a7695 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 15:27:57 +1100 Subject: [PATCH 05/23] CI/CD test the flow --- .github/workflows/SSW.SophieBot.dev.yml | 324 ++++++++++++------------ 1 file changed, 162 insertions(+), 162 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 25c6bb3f..af94f58f 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -30,7 +30,7 @@ env: PUBLISHING_PROFILE_NAME: SSW.Bots.Dev LUIS_AUTHORING_ENDPOINT: https://australiaeast.api.cognitive.microsoft.com/ LUIS_AUTHORING_REGION: australiaeast - BUILD_ENVIRONMENT: "${{github.event_name == 'workflow_dispatch' && 'prod' || 'dev' }}" + BUILD_ENVIRONMENT: "${{ github.event_name == 'workflow_dispatch' && 'prod' || 'dev' }}" defaults: run: @@ -44,164 +44,164 @@ jobs: - name: Test the build environment run: echo "environment is = " $BUILD_ENVIRONMENT - run: echo "event is" ${{ github.event_name }} - build: - name: Build - runs-on: ubuntu-latest - environment: $BUILD_ENVIRONMENT - steps: - - uses: actions/checkout@v2.3.4 - - - name: Use Node 16.x - uses: actions/setup-node@v2.4.0 - with: - node-version: "16" - - name: Use BF CLI - run: npm install -g @microsoft/botframework-cli - - name: Use .Net sdk 6.0.x - uses: actions/setup-dotnet@v1.9.0 - with: - dotnet-version: "6.0.x" - - - name: Create appsettings file - uses: jsdaniell/create-json@1.1.2 - 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@v2.2.4 - 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@v2.3.1 - 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@v2.3.1 - 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: $BUILD_ENVIRONMENT - steps: - - uses: actions/checkout@v2.3.4 - - - name: Use .Net sdk 6.0.x - uses: actions/setup-dotnet@v1.9.0 - with: - dotnet-version: "6.0.x" - - - uses: actions/download-artifact@v2 - 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: $BUILD_ENVIRONMENT - steps: - - uses: actions/checkout@v2.3.4 - - - uses: actions/download-artifact@v2 - with: - name: "LUIS_Migrator_${{ github.run_id }}" - path: ${{ env.OUTPUT_DIR }}/luis-migrator - - - name: Create appsettings file - uses: jsdaniell/create-json@1.1.2 - 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 + # build: + # name: Build + # runs-on: ubuntu-latest + # environment: $BUILD_ENVIRONMENT + # steps: + # - uses: actions/checkout@v2.3.4 + + # - name: Use Node 16.x + # uses: actions/setup-node@v2.4.0 + # with: + # node-version: "16" + # - name: Use BF CLI + # run: npm install -g @microsoft/botframework-cli + # - name: Use .Net sdk 6.0.x + # uses: actions/setup-dotnet@v1.9.0 + # with: + # dotnet-version: "6.0.x" + + # - name: Create appsettings file + # uses: jsdaniell/create-json@1.1.2 + # 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@v2.2.4 + # 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@v2.3.1 + # 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@v2.3.1 + # 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: $BUILD_ENVIRONMENT + # steps: + # - uses: actions/checkout@v2.3.4 + + # - name: Use .Net sdk 6.0.x + # uses: actions/setup-dotnet@v1.9.0 + # with: + # dotnet-version: "6.0.x" + + # - uses: actions/download-artifact@v2 + # 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: $BUILD_ENVIRONMENT + # steps: + # - uses: actions/checkout@v2.3.4 + + # - uses: actions/download-artifact@v2 + # with: + # name: "LUIS_Migrator_${{ github.run_id }}" + # path: ${{ env.OUTPUT_DIR }}/luis-migrator + + # - name: Create appsettings file + # uses: jsdaniell/create-json@1.1.2 + # 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 From 18f09ffd4dbd82dac0b86b4d94173309177c3de4 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 15:29:00 +1100 Subject: [PATCH 06/23] CI/Cd test again --- .github/workflows/SSW.SophieBot.dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index af94f58f..4c6692c2 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -44,6 +44,7 @@ jobs: - name: Test the build environment run: echo "environment is = " $BUILD_ENVIRONMENT - run: echo "event is" ${{ github.event_name }} + - run: echo "environment2 is = " $LUIS_AUTHORING_REGION # build: # name: Build # runs-on: ubuntu-latest From 122b74946a6c011060bc0d39b32607ff004dcd2b Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 15:31:40 +1100 Subject: [PATCH 07/23] CI/CD: test if environment variable is working --- .github/workflows/SSW.SophieBot.dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 4c6692c2..5ceaa4cc 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -42,9 +42,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Test the build environment - run: echo "environment is = " $BUILD_ENVIRONMENT + run: echo "environment is = $BUILD_ENVIRONMENT" - run: echo "event is" ${{ github.event_name }} - - run: echo "environment2 is = " $LUIS_AUTHORING_REGION + - run: echo "environment2 is = $LUIS_AUTHORING_REGION" # build: # name: Build # runs-on: ubuntu-latest From 13ff6a353783fbbcbd35fd62004cd1b071368648 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 15:38:51 +1100 Subject: [PATCH 08/23] CI/CD add space to the env keyword --- .github/workflows/SSW.SophieBot.dev.yml | 326 ++++++++++++------------ 1 file changed, 162 insertions(+), 164 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 5ceaa4cc..ec60094f 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -42,167 +42,165 @@ jobs: runs-on: ubuntu-latest steps: - name: Test the build environment - run: echo "environment is = $BUILD_ENVIRONMENT" - - run: echo "event is" ${{ github.event_name }} - - run: echo "environment2 is = $LUIS_AUTHORING_REGION" - # build: - # name: Build - # runs-on: ubuntu-latest - # environment: $BUILD_ENVIRONMENT - # steps: - # - uses: actions/checkout@v2.3.4 - - # - name: Use Node 16.x - # uses: actions/setup-node@v2.4.0 - # with: - # node-version: "16" - # - name: Use BF CLI - # run: npm install -g @microsoft/botframework-cli - # - name: Use .Net sdk 6.0.x - # uses: actions/setup-dotnet@v1.9.0 - # with: - # dotnet-version: "6.0.x" - - # - name: Create appsettings file - # uses: jsdaniell/create-json@1.1.2 - # 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@v2.2.4 - # 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@v2.3.1 - # 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@v2.3.1 - # 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: $BUILD_ENVIRONMENT - # steps: - # - uses: actions/checkout@v2.3.4 - - # - name: Use .Net sdk 6.0.x - # uses: actions/setup-dotnet@v1.9.0 - # with: - # dotnet-version: "6.0.x" - - # - uses: actions/download-artifact@v2 - # 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: $BUILD_ENVIRONMENT - # steps: - # - uses: actions/checkout@v2.3.4 - - # - uses: actions/download-artifact@v2 - # with: - # name: "LUIS_Migrator_${{ github.run_id }}" - # path: ${{ env.OUTPUT_DIR }}/luis-migrator - - # - name: Create appsettings file - # uses: jsdaniell/create-json@1.1.2 - # 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 + run: echo "environment is ${{ env.BUILD_ENVIRONMENT }}" + build: + name: Build + runs-on: ubuntu-latest + environment: ${{ env.BUILD_ENVIRONMENT }} + steps: + - uses: actions/checkout@v2.3.4 + + - name: Use Node 16.x + uses: actions/setup-node@v2.4.0 + with: + node-version: "16" + - name: Use BF CLI + run: npm install -g @microsoft/botframework-cli + - name: Use .Net sdk 6.0.x + uses: actions/setup-dotnet@v1.9.0 + with: + dotnet-version: "6.0.x" + + - name: Create appsettings file + uses: jsdaniell/create-json@1.1.2 + 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@v2.2.4 + 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@v2.3.1 + 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@v2.3.1 + 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: ${{ env.BUILD_ENVIRONMENT }} + steps: + - uses: actions/checkout@v2.3.4 + + - name: Use .Net sdk 6.0.x + uses: actions/setup-dotnet@v1.9.0 + with: + dotnet-version: "6.0.x" + + - uses: actions/download-artifact@v2 + 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: ${{ env.BUILD_ENVIRONMENT }} + steps: + - uses: actions/checkout@v2.3.4 + + - uses: actions/download-artifact@v2 + with: + name: "LUIS_Migrator_${{ github.run_id }}" + path: ${{ env.OUTPUT_DIR }}/luis-migrator + + - name: Create appsettings file + uses: jsdaniell/create-json@1.1.2 + 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 From be6fde131c21edb062a65e11a5b0ff46f3828c87 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 15:41:49 +1100 Subject: [PATCH 09/23] CI/CD-try to add " to the environment variable --- .github/workflows/SSW.SophieBot.dev.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index ec60094f..d8c79bda 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -46,7 +46,7 @@ jobs: build: name: Build runs-on: ubuntu-latest - environment: ${{ env.BUILD_ENVIRONMENT }} + environment: "${{ env.BUILD_ENVIRONMENT }}" steps: - uses: actions/checkout@v2.3.4 @@ -159,7 +159,7 @@ jobs: name: Deploy web app needs: build runs-on: ubuntu-latest - environment: ${{ env.BUILD_ENVIRONMENT }} + environment: "${{ env.BUILD_ENVIRONMENT }}" steps: - uses: actions/checkout@v2.3.4 @@ -185,7 +185,7 @@ jobs: name: Migrate LUIS model needs: build runs-on: windows-latest - environment: ${{ env.BUILD_ENVIRONMENT }} + environment: "${{ env.BUILD_ENVIRONMENT }}" steps: - uses: actions/checkout@v2.3.4 From 82468e81529abddad46a0dd650bdfc2611eeb78b Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 15:49:53 +1100 Subject: [PATCH 10/23] CI/CD update the environment section --- .github/workflows/SSW.SophieBot.dev.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index d8c79bda..8ec7cc80 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -37,6 +37,7 @@ defaults: shell: pwsh jobs: + environment: test-flow: name: Test flow runs-on: ubuntu-latest @@ -46,7 +47,8 @@ jobs: build: name: Build runs-on: ubuntu-latest - environment: "${{ env.BUILD_ENVIRONMENT }}" + environment: + name: "${{ env.BUILD_ENVIRONMENT }}" steps: - uses: actions/checkout@v2.3.4 @@ -159,7 +161,8 @@ jobs: name: Deploy web app needs: build runs-on: ubuntu-latest - environment: "${{ env.BUILD_ENVIRONMENT }}" + environment: + name: "${{ env.BUILD_ENVIRONMENT }}" steps: - uses: actions/checkout@v2.3.4 @@ -185,7 +188,8 @@ jobs: name: Migrate LUIS model needs: build runs-on: windows-latest - environment: "${{ env.BUILD_ENVIRONMENT }}" + environment: + name: "${{ env.BUILD_ENVIRONMENT }}" steps: - uses: actions/checkout@v2.3.4 From 5f9fad7b292cf5d66a05b93acf557165d58bea21 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 16:52:03 +1100 Subject: [PATCH 11/23] CI/CD-create reusable workflow and pass value --- .github/workflows/SSW.SophieBot.dev.yml | 197 +----------------------- .github/workflows/reuse.workflow.yml | 197 ++++++++++++++++++++++++ 2 files changed, 205 insertions(+), 189 deletions(-) create mode 100644 .github/workflows/reuse.workflow.yml diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 8ec7cc80..2205e9a0 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -14,197 +14,16 @@ on: - ".github/workflows/SSW.SophieBot.dev.yml" - ".github/workflows/scripts/**" -concurrency: - group: SSWSophieBotDev-BuildAndDeploy - cancel-in-progress: true - -env: - BUILD_FLOW: composer - BOT_NAME: SSWSophieBotDev - WEBAPP_NAME: SSWSophieBotDev-Linux - 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 - BUILD_ENVIRONMENT: "${{ github.event_name == 'workflow_dispatch' && 'prod' || 'dev' }}" - -defaults: - run: - shell: pwsh jobs: - environment: - test-flow: - name: Test flow - runs-on: ubuntu-latest - steps: - - name: Test the build environment - run: echo "environment is ${{ env.BUILD_ENVIRONMENT }}" - build: - name: Build + call-work-flow: runs-on: ubuntu-latest - environment: - name: "${{ env.BUILD_ENVIRONMENT }}" + environment: Deploy-Dev steps: - - uses: actions/checkout@v2.3.4 - - - name: Use Node 16.x - uses: actions/setup-node@v2.4.0 - with: - node-version: "16" - - name: Use BF CLI - run: npm install -g @microsoft/botframework-cli - - name: Use .Net sdk 6.0.x - uses: actions/setup-dotnet@v1.9.0 + - uses: ./.github/workflows/reuse.workflow.yml with: - dotnet-version: "6.0.x" - - - name: Create appsettings file - uses: jsdaniell/create-json@1.1.2 - 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@v2.2.4 - 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@v2.3.1 - 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@v2.3.1 - 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: - name: "${{ env.BUILD_ENVIRONMENT }}" - steps: - - uses: actions/checkout@v2.3.4 - - - name: Use .Net sdk 6.0.x - uses: actions/setup-dotnet@v1.9.0 - with: - dotnet-version: "6.0.x" - - - uses: actions/download-artifact@v2 - 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: - name: "${{ env.BUILD_ENVIRONMENT }}" - steps: - - uses: actions/checkout@v2.3.4 - - - uses: actions/download-artifact@v2 - with: - name: "LUIS_Migrator_${{ github.run_id }}" - path: ${{ env.OUTPUT_DIR }}/luis-migrator - - - name: Create appsettings file - uses: jsdaniell/create-json@1.1.2 - 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 + BOT_APP_APPSETTINGS: ${{ secrets.BOT_APP_APPSETTINGS }} + LUIS_AUTHORING_KEY: ${{ secrets.LUIS_AUTHORING_KEY }} + BOT_WEBAPP_PUBLISH_PROFILE: ${{ secrets.BOT_WEBAPP_PUBLISH_PROFILE }} + LUIS_MIGRATOR_APPSETTINGS : ${{ secrets.LUIS_MIGRATOR_APPSETTINGS }} + \ No newline at end of file diff --git a/.github/workflows/reuse.workflow.yml b/.github/workflows/reuse.workflow.yml new file mode 100644 index 00000000..429fefd5 --- /dev/null +++ b/.github/workflows/reuse.workflow.yml @@ -0,0 +1,197 @@ + +name: Reusable workflow example + +on: + workflow_call: + secrets: + BOT_APP_APPSETTINGS: + required: true + LUIS_AUTHORING_KEY: + required: true + BOT_WEBAPP_PUBLISH_PROFILE: + required: true + LUIS_MIGRATOR_APPSETTINGS : + required: true + + +concurrency: + group: SSWSophieBotDev-BuildAndDeploy + cancel-in-progress: true + +env: + BUILD_FLOW: composer + BOT_NAME: SSWSophieBotDev + WEBAPP_NAME: SSWSophieBotDev-Linux + 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 + steps: + - uses: actions/checkout@v2.3.4 + + - name: Use Node 16.x + uses: actions/setup-node@v2.4.0 + with: + node-version: "16" + - name: Use BF CLI + run: npm install -g @microsoft/botframework-cli + - name: Use .Net sdk 6.0.x + uses: actions/setup-dotnet@v1.9.0 + with: + dotnet-version: "6.0.x" + + - name: Create appsettings file + uses: jsdaniell/create-json@1.1.2 + 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@v2.2.4 + 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@v2.3.1 + 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@v2.3.1 + 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 + steps: + - uses: actions/checkout@v2.3.4 + + - name: Use .Net sdk 6.0.x + uses: actions/setup-dotnet@v1.9.0 + with: + dotnet-version: "6.0.x" + + - uses: actions/download-artifact@v2 + 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 + # steps: + # - uses: actions/checkout@v2.3.4 + + # - uses: actions/download-artifact@v2 + # with: + # name: "LUIS_Migrator_${{ github.run_id }}" + # path: ${{ env.OUTPUT_DIR }}/luis-migrator + + # - name: Create appsettings file + # uses: jsdaniell/create-json@1.1.2 + # 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 From a070c52ac7645ea1b2d76aabd047e8b686649b1a Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 16:55:25 +1100 Subject: [PATCH 12/23] CI/CD add checkout --- .github/workflows/SSW.SophieBot.dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 2205e9a0..b7592d38 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -20,6 +20,7 @@ jobs: runs-on: ubuntu-latest environment: Deploy-Dev steps: + - uses: actions/checkout@v3 - uses: ./.github/workflows/reuse.workflow.yml with: BOT_APP_APPSETTINGS: ${{ secrets.BOT_APP_APPSETTINGS }} From cd9df8528ed8170ac467708385ede06490e467b9 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 17:07:49 +1100 Subject: [PATCH 13/23] rename the work flow --- .github/workflows/SSW.SophieBot.dev.yml | 2 +- .github/workflows/{reuse.workflow.yml => workflow-deploy.yml} | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) rename .github/workflows/{reuse.workflow.yml => workflow-deploy.yml} (99%) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index b7592d38..14c438b9 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -21,7 +21,7 @@ jobs: environment: Deploy-Dev steps: - uses: actions/checkout@v3 - - uses: ./.github/workflows/reuse.workflow.yml + - uses: ./.github/workflows/workflow-deploy.yml with: BOT_APP_APPSETTINGS: ${{ secrets.BOT_APP_APPSETTINGS }} LUIS_AUTHORING_KEY: ${{ secrets.LUIS_AUTHORING_KEY }} diff --git a/.github/workflows/reuse.workflow.yml b/.github/workflows/workflow-deploy.yml similarity index 99% rename from .github/workflows/reuse.workflow.yml rename to .github/workflows/workflow-deploy.yml index 429fefd5..01f2ffb3 100644 --- a/.github/workflows/reuse.workflow.yml +++ b/.github/workflows/workflow-deploy.yml @@ -1,4 +1,3 @@ - name: Reusable workflow example on: From 2efc9369060face8b06d0fb8d7c064f45410971b Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 17:16:49 +1100 Subject: [PATCH 14/23] CI/CD-update-the-reusable-workflow --- .github/workflows/SSW.SophieBot.dev.yml | 14 ++---- .github/workflows/workflow-deploy.yml | 59 ++++++++++++------------- 2 files changed, 32 insertions(+), 41 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 14c438b9..833c1462 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -17,14 +17,8 @@ on: jobs: call-work-flow: - runs-on: ubuntu-latest - environment: Deploy-Dev - steps: - - uses: actions/checkout@v3 - - uses: ./.github/workflows/workflow-deploy.yml - with: - BOT_APP_APPSETTINGS: ${{ secrets.BOT_APP_APPSETTINGS }} - LUIS_AUTHORING_KEY: ${{ secrets.LUIS_AUTHORING_KEY }} - BOT_WEBAPP_PUBLISH_PROFILE: ${{ secrets.BOT_WEBAPP_PUBLISH_PROFILE }} - LUIS_MIGRATOR_APPSETTINGS : ${{ secrets.LUIS_MIGRATOR_APPSETTINGS }} + uses: ./.github/workflows/workflow-deploy.yml + with: + environment: dev + \ No newline at end of file diff --git a/.github/workflows/workflow-deploy.yml b/.github/workflows/workflow-deploy.yml index 01f2ffb3..46922ec8 100644 --- a/.github/workflows/workflow-deploy.yml +++ b/.github/workflows/workflow-deploy.yml @@ -2,15 +2,10 @@ name: Reusable workflow example on: workflow_call: - secrets: - BOT_APP_APPSETTINGS: + inputs: + environment: + type: string required: true - LUIS_AUTHORING_KEY: - required: true - BOT_WEBAPP_PUBLISH_PROFILE: - required: true - LUIS_MIGRATOR_APPSETTINGS : - required: true concurrency: @@ -35,10 +30,10 @@ defaults: shell: pwsh jobs: - build: name: Build runs-on: ubuntu-latest + environment: ${{ inputs.environment }} steps: - uses: actions/checkout@v2.3.4 @@ -150,6 +145,7 @@ jobs: deploy-web-app: name: Deploy web app needs: build + environment: ${{ inputs.environment }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.3.4 @@ -172,25 +168,26 @@ jobs: 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 - # steps: - # - uses: actions/checkout@v2.3.4 - - # - uses: actions/download-artifact@v2 - # with: - # name: "LUIS_Migrator_${{ github.run_id }}" - # path: ${{ env.OUTPUT_DIR }}/luis-migrator - - # - name: Create appsettings file - # uses: jsdaniell/create-json@1.1.2 - # 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 + migrate-luis-model: + name: Migrate LUIS model + needs: build + runs-on: windows-latest + environment: ${{ inputs.environment }} + steps: + - uses: actions/checkout@v2.3.4 + + - uses: actions/download-artifact@v2 + with: + name: "LUIS_Migrator_${{ github.run_id }}" + path: ${{ env.OUTPUT_DIR }}/luis-migrator + + - name: Create appsettings file + uses: jsdaniell/create-json@1.1.2 + 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 From 34624f540e1c7174fbb799a399a0f30063b772d2 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 17:20:46 +1100 Subject: [PATCH 15/23] CI/CD-update secret inherit --- .github/workflows/SSW.SophieBot.dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 833c1462..c642591f 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -20,5 +20,6 @@ jobs: uses: ./.github/workflows/workflow-deploy.yml with: environment: dev + secrets: inherit \ No newline at end of file From 2f969c799be55d895abc1af55959f1281e674034 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 17:24:05 +1100 Subject: [PATCH 16/23] CI/CD-update-the-reusable-workflow --- .github/workflows/workflow-deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow-deploy.yml b/.github/workflows/workflow-deploy.yml index 46922ec8..88a1ea7f 100644 --- a/.github/workflows/workflow-deploy.yml +++ b/.github/workflows/workflow-deploy.yml @@ -7,6 +7,8 @@ on: type: string required: true + secrets: + concurrency: group: SSWSophieBotDev-BuildAndDeploy From ae0568b81a5337fd9e21235cc6f7fae90e80503a Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 17:25:09 +1100 Subject: [PATCH 17/23] CI/CD fix the identation --- .github/workflows/SSW.SophieBot.dev.yml | 2 +- .github/workflows/workflow-deploy.yml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index c642591f..00ba4ea0 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -20,6 +20,6 @@ jobs: uses: ./.github/workflows/workflow-deploy.yml with: environment: dev - secrets: inherit + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/workflow-deploy.yml b/.github/workflows/workflow-deploy.yml index 88a1ea7f..46922ec8 100644 --- a/.github/workflows/workflow-deploy.yml +++ b/.github/workflows/workflow-deploy.yml @@ -7,8 +7,6 @@ on: type: string required: true - secrets: - concurrency: group: SSWSophieBotDev-BuildAndDeploy From 637517b452945d7068df6cf77311b4a0f95290a8 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Thu, 6 Oct 2022 17:34:23 +1100 Subject: [PATCH 18/23] CI/CD-add-condition-on-push-or-dispatch --- .github/workflows/SSW.SophieBot.dev.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 00ba4ea0..99c626d8 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -16,10 +16,18 @@ on: jobs: - call-work-flow: + run-dev-flow: + if: github.event_name == 'workflow_dispatch' uses: ./.github/workflows/workflow-deploy.yml with: - environment: dev + environment: prod secrets: inherit + + run-prod-flow: + if: github.event_name == 'push' + uses: ./.github/workflows/workflow-deploy.yml + with: + environment: dev + secrets: inherit \ No newline at end of file From 257b78c324d433a1ca3d6122ddd0093268a2bb4b Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Fri, 7 Oct 2022 11:19:21 +1100 Subject: [PATCH 19/23] CI/CD: maintain the dotnet sdk with global json file --- .github/workflows/SSW.SophieBot.dev.yml | 4 ++-- .github/workflows/workflow-deploy.yml | 4 ++-- global.json | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 global.json diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 99c626d8..6eb13f02 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -16,14 +16,14 @@ on: jobs: - run-dev-flow: + run-prod-flow: if: github.event_name == 'workflow_dispatch' uses: ./.github/workflows/workflow-deploy.yml with: environment: prod secrets: inherit - run-prod-flow: + run-dev-flow: if: github.event_name == 'push' uses: ./.github/workflows/workflow-deploy.yml with: diff --git a/.github/workflows/workflow-deploy.yml b/.github/workflows/workflow-deploy.yml index 46922ec8..340ade87 100644 --- a/.github/workflows/workflow-deploy.yml +++ b/.github/workflows/workflow-deploy.yml @@ -46,7 +46,7 @@ jobs: - name: Use .Net sdk 6.0.x uses: actions/setup-dotnet@v1.9.0 with: - dotnet-version: "6.0.x" + global-json-file: global.json - name: Create appsettings file uses: jsdaniell/create-json@1.1.2 @@ -153,7 +153,7 @@ jobs: - name: Use .Net sdk 6.0.x uses: actions/setup-dotnet@v1.9.0 with: - dotnet-version: "6.0.x" + global-json-file: global.json - uses: actions/download-artifact@v2 with: diff --git a/global.json b/global.json new file mode 100644 index 00000000..28d32793 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "6.0.9" + } + } \ No newline at end of file From bb1a35551ba8ccfd80e9de825bfaa398b0ac8a41 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Fri, 7 Oct 2022 11:24:36 +1100 Subject: [PATCH 20/23] fix the bug --- .github/workflows/SSW.SophieBot.test.yml | 4 ++-- .github/workflows/workflow-deploy.yml | 4 ++-- global.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/SSW.SophieBot.test.yml b/.github/workflows/SSW.SophieBot.test.yml index 35684348..eea4f2cf 100644 --- a/.github/workflows/SSW.SophieBot.test.yml +++ b/.github/workflows/SSW.SophieBot.test.yml @@ -29,9 +29,9 @@ jobs: - uses: actions/checkout@v2.3.4 - name: Use .Net sdk 6.0.x - uses: actions/setup-dotnet@v1.9.0 + uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' + global-json-file: global.json - name: Build all run: .\build-all.ps1 diff --git a/.github/workflows/workflow-deploy.yml b/.github/workflows/workflow-deploy.yml index 340ade87..cb461ec9 100644 --- a/.github/workflows/workflow-deploy.yml +++ b/.github/workflows/workflow-deploy.yml @@ -44,7 +44,7 @@ jobs: - name: Use BF CLI run: npm install -g @microsoft/botframework-cli - name: Use .Net sdk 6.0.x - uses: actions/setup-dotnet@v1.9.0 + uses: actions/setup-dotnet@v3 with: global-json-file: global.json @@ -151,7 +151,7 @@ jobs: - uses: actions/checkout@v2.3.4 - name: Use .Net sdk 6.0.x - uses: actions/setup-dotnet@v1.9.0 + uses: actions/setup-dotnet@v3 with: global-json-file: global.json diff --git a/global.json b/global.json index 28d32793..01194eed 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "6.0.9" + "version": "6.0.x" } - } \ No newline at end of file +} \ No newline at end of file From b8f5381343ff6dd6341417b4cf4b94ce61706015 Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Fri, 7 Oct 2022 11:32:05 +1100 Subject: [PATCH 21/23] CI/CD: rename the use .net sdk session --- .github/workflows/workflow-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-deploy.yml b/.github/workflows/workflow-deploy.yml index cb461ec9..5c7ef82f 100644 --- a/.github/workflows/workflow-deploy.yml +++ b/.github/workflows/workflow-deploy.yml @@ -150,7 +150,7 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - - name: Use .Net sdk 6.0.x + - name: Use .Net sdk uses: actions/setup-dotnet@v3 with: global-json-file: global.json From b3eda4cd7272d804d1dfece230d1624476618bcc Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Fri, 7 Oct 2022 11:34:57 +1100 Subject: [PATCH 22/23] CI/CD: delete unnecessary folders --- .github/workflows/workflow-deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/workflow-deploy.yml b/.github/workflows/workflow-deploy.yml index 5c7ef82f..16742589 100644 --- a/.github/workflows/workflow-deploy.yml +++ b/.github/workflows/workflow-deploy.yml @@ -55,7 +55,6 @@ jobs: 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: | From 065ab826778c9e0666f8d40c91b9e05b2df9ad9e Mon Sep 17 00:00:00 2001 From: JackDuan123 Date: Fri, 7 Oct 2022 11:38:50 +1100 Subject: [PATCH 23/23] CI/CD - add comments on the work flow --- .github/workflows/SSW.SophieBot.dev.yml | 4 +++- .github/workflows/SSW.SophieBot.prod.yml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/SSW.SophieBot.dev.yml b/.github/workflows/SSW.SophieBot.dev.yml index 6eb13f02..bd2bb707 100644 --- a/.github/workflows/SSW.SophieBot.dev.yml +++ b/.github/workflows/SSW.SophieBot.dev.yml @@ -1,4 +1,6 @@ -name: Build and Deploy-Dev +# this is the new workflow +# if the flow is manully triggered, it will deploy to the production, if the flow is triggered by a push, it will deploy to the development +name: Build and Deploy on: diff --git a/.github/workflows/SSW.SophieBot.prod.yml b/.github/workflows/SSW.SophieBot.prod.yml index 9e9b69ed..f11ea7f3 100644 --- a/.github/workflows/SSW.SophieBot.prod.yml +++ b/.github/workflows/SSW.SophieBot.prod.yml @@ -1,3 +1,4 @@ +# we don't need this workflow any more please delete it name: Build and Deploy-Prod on: workflow_dispatch