From e52fa73e17e46ef34ba5b3b2b5a8b2dbe35fdd80 Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Sun, 13 Aug 2023 20:19:53 -0700 Subject: [PATCH 01/10] Add version number information in backend, frontend and build process --- .github/workflows/copilot-build-backend.yml | 30 +++-- .github/workflows/copilot-build-frontend.yml | 35 ------ .github/workflows/copilot-deploy-frontend.yml | 23 +++- .github/workflows/typos.yaml | 29 ----- .github/workflows/update-version.sh | 107 ------------------ .gitignore | 5 +- scripts/deploy/deploy-webapp.ps1 | 10 ++ scripts/deploy/deploy-webapp.sh | 14 +++ scripts/deploy/package-webapi.ps1 | 10 +- scripts/deploy/package-webapi.sh | 18 ++- .../Controllers/ServiceOptionsController.cs | 29 +++-- .../Models/Response/ServiceOptionsResponse.cs | 26 +---- .../src/components/chat/tabs/DocumentsTab.tsx | 17 +-- .../header/settings-dialog/SettingsDialog.tsx | 15 ++- webapp/src/libs/models/ServiceOptions.ts | 7 +- webapp/src/libs/services/ChatService.ts | 2 +- webapp/src/redux/features/app/AppState.ts | 2 +- 17 files changed, 138 insertions(+), 241 deletions(-) delete mode 100644 .github/workflows/copilot-build-frontend.yml delete mode 100644 .github/workflows/typos.yaml delete mode 100644 .github/workflows/update-version.sh diff --git a/.github/workflows/copilot-build-backend.yml b/.github/workflows/copilot-build-backend.yml index e82da790e..96bdf34ee 100644 --- a/.github/workflows/copilot-build-backend.yml +++ b/.github/workflows/copilot-build-backend.yml @@ -35,22 +35,36 @@ jobs: with: clean: true - - name: Package Copilot Chat WebAPI - run: | - scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: '5.x' - - name: Check formatting of Copilot Chat WebAPI - run: | - cd webapi/ - dotnet format --verify-no-changes --verbosity diagnostic + - name: Display GitVersion config + id: gitversion + uses: gittools/actions/gitversion/execute@v0 + with: + additionalArguments: '/showConfig' - name: Set version tag id: versiontag run: | - $VERSION_TAG="$(Get-Date -Format "MMddHHmmss")" + $VERSION_TAG = "${{ steps.gitversion.outputs.Major }}." + $VERSION_TAG += "${{ steps.gitversion.outputs.Minor }}." + $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." + $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}" echo $VERSION_TAG Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT + - name: Package Copilot Chat WebAPI + run: | + scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy -Version ${{ steps.versiontag.outputs.versiontag }} -InformationalVersion "Commit steps.gitversion.outputs.ShortSha" + + - name: Check formatting of Copilot Chat WebAPI + run: | + cd webapi/ + dotnet format --verify-no-changes --verbosity diagnostic + - name: Upload package to artifacts uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/copilot-build-frontend.yml b/.github/workflows/copilot-build-frontend.yml deleted file mode 100644 index 7c8fb46ce..000000000 --- a/.github/workflows/copilot-build-frontend.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: copilot-build-frontend - -on: - workflow_dispatch: - pull_request: - branches: ["main"] - paths: - - "webapp/**" - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - webapp: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: "yarn" - cache-dependency-path: "webapp/yarn.lock" - - - name: Run yarn install, yarn build, & yarn format - run: | - #!/bin/bash - set -e # exit with nonzero exit code if anything fails - echo "Running yarn install, yarn build, & yarn format" - yarn install --frozen-lockfile # install dependencies and ensure lockfile is unchanged. - yarn build # run build script - yarn format # run format script - working-directory: webapp diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index 77ee5fb9c..a00f0e180 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -69,6 +69,27 @@ jobs: echo "::add-mask::$swaToken" echo "SWA_CLI_DEPLOYMENT_TOKEN=$swaToken" >> $GITHUB_ENV + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: '5.x' + + - name: Display GitVersion config + id: gitversion + uses: gittools/actions/gitversion/execute@v0 + with: + additionalArguments: '/showConfig' + + - name: Set version tag + id: versiontag + run: | + $VERSION_TAG = "${{ steps.gitversion.outputs.Major }}." + $VERSION_TAG += "${{ steps.gitversion.outputs.Minor }}." + $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." + $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}" + echo $VERSION_TAG + Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT + - name: Deploy SWA run: | - scripts/deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect + scripts/deploy/deploy-webapp.sh --Subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect -version ${{ steps.versiontag.outputs.versiontag }} -informational_version "Commit steps.gitversion.outputs.ShortSha" diff --git a/.github/workflows/typos.yaml b/.github/workflows/typos.yaml deleted file mode 100644 index 1d2b0df54..000000000 --- a/.github/workflows/typos.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Check pull requests for typos. -# -# Configuration: .github/_typos.toml -# -# Info: https://github.com/marketplace/actions/typos-action -# Local install: brew install typos-cli -# Local install: conda install typos -# Local run: typos -c .github/_typos.toml - -name: Spell Check - -on: - workflow_dispatch: - pull_request: - branches: [ "main", "feature*" ] - -jobs: - run: - name: Spell Check with Typos - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Use custom config file - uses: crate-ci/typos@master - with: - config: .github/_typos.toml - write_changes: false diff --git a/.github/workflows/update-version.sh b/.github/workflows/update-version.sh deleted file mode 100644 index 5db3622f6..000000000 --- a/.github/workflows/update-version.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash - -POSITIONAL_ARGS=() - -while [[ $# -gt 0 ]]; do - case $1 in - -f|--file) - file="$2" - shift # past argument - shift # past value - ;; - -p|--propsFile) - propsFile="$2" - shift # past argument - shift # past value - ;; - -b|--buildAndRevisionNumber) - buildAndRevisionNumber="$2" - shift # past argument - shift # past value - ;; - -*|--*) - echo "Unknown option $1" - exit 1 - ;; - *) - POSITIONAL_ARGS+=("$1") # save positional arg - shift # past argument - ;; - esac -done - -set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters - -if [ -z "$file" ]; then - echo "ERROR: Parameter file (-f|--file) not provided" - exit 1; -elif [ ! -f "$file" ]; then - echo "ERROR: file ${file} not found" - exit 1; -fi - -if [ -n "$(cat $file | grep -i "false")" ]; then - echo "Project is marked as NOT packable - skipping." - exit 0; -fi - -if [ -z "$propsFile" ]; then - echo "ERROR: Parameter propsFile (-f|--file) not provided" - exit 1; -elif [ ! -f "$propsFile" ]; then - echo "ERROR: propsFile ${file} not found" - exit 1; -fi - -if [ -z "$buildAndRevisionNumber" ]; then - echo "ERROR: Parameter buildAndRevisionNumber (-b|--buildAndRevisionNumber) not provided" - exit 1; -fi - -propsVersionString=$(cat $propsFile | grep -i ""); -regex="([0-9.]*)<\/Version>" -if [[ $propsVersionString =~ $regex ]]; then - propsVersion=${BASH_REMATCH[1]} -else - echo "ERROR: Version tag not found in propsFile" - exit 1; -fi - -if [ -z "$propsVersion" ]; then - echo "ERROR: Version tag not found in propsFile" - exit 1; -elif [[ ! "$propsVersion" =~ ^0.* ]]; then - echo "ERROR: Version expected to start with 0. Actual: ${propsVersion}" - exit 1; -fi - -fullVersionString="${propsVersion}.${buildAndRevisionNumber}-preview" - -if [[ ! "$fullVersionString" =~ ^0.* ]]; then - echo "ERROR: Version expected to start with 0. Actual: ${fullVersionString}" - exit 1; -fi - -echo "==== Project: ${file} ===="; -echo "propsFile = ${propsFile}" -echo "buildAndRevisionNumber = ${buildAndRevisionNumber}" -echo "version prefix from propsFile = ${propsVersion}" -echo "full version string: ${fullVersionString}" - -versionInProj=$(cat $file | grep -i ""); -if [ -n "$versionInProj" ]; then - # Version tag already exists in the csproj. Let's replace it. - echo "Updating version tag..." - content=$(cat $file | sed --expression="s/\([0-9]*.[0-9]*\)<\/Version>/$fullVersionString<\/Version>/g"); -else - # Version tag not found in the csproj. Let's add it. - echo "Project is packable - adding version tag..." - content=$(cat $file | sed --expression="s/<\/Project>/$fullVersionString<\/Version><\/PropertyGroup><\/Project>/g"); -fi - -if [ $? -ne 0 ]; then exit 1; fi -echo "$content" && echo "$content" > $file; -if [ $? -ne 0 ]; then exit 1; fi - -echo "DONE"; -echo ""; diff --git a/.gitignore b/.gitignore index f09d4d638..9aedfda45 100644 --- a/.gitignore +++ b/.gitignore @@ -483,4 +483,7 @@ webapp/node_modules/ webapp/public/.well-known* # Auto-generated solution file from Visual Studio -webapi/CopilotChatWebApi.sln \ No newline at end of file +webapi/CopilotChatWebApi.sln + +# Files created for deployments +/deploy/ \ No newline at end of file diff --git a/scripts/deploy/deploy-webapp.ps1 b/scripts/deploy/deploy-webapp.ps1 index 88b3d1c99..b120c01fd 100644 --- a/scripts/deploy/deploy-webapp.ps1 +++ b/scripts/deploy/deploy-webapp.ps1 @@ -28,6 +28,14 @@ param( [string] # Authority for client applications that are not configured as multi-tenant. $Authority="https://login.microsoftonline.com/common" + + [string] + # Version to display in UI. + $Version = "" + + [string] + # Additional information given in version info. + $InformationalVersion = "" ) Write-Host "Setting up Azure credentials..." @@ -64,6 +72,8 @@ Write-Host "Writing environment variables to '$envFilePath'..." "REACT_APP_AAD_AUTHORITY=$Authority" | Out-File -FilePath $envFilePath -Append "REACT_APP_AAD_CLIENT_ID=$ApplicationClientId" | Out-File -FilePath $envFilePath -Append "REACT_APP_SK_API_KEY=$webapiApiKey" | Out-File -FilePath $envFilePath -Append +"REACT_APP_SK_VERSION=$Version" | Out-File -FilePat +"REACT_APP_SK_BUILD_INFO=$InformationalVersion" | Out-File -FilePat Write-Host "Generating SWA config..." $swaConfig = $(Get-Content "$PSScriptRoot/../../webapp/template.swa-cli.config.json" -Raw) diff --git a/scripts/deploy/deploy-webapp.sh b/scripts/deploy/deploy-webapp.sh index 66ef188cc..c206ada33 100755 --- a/scripts/deploy/deploy-webapp.sh +++ b/scripts/deploy/deploy-webapp.sh @@ -15,6 +15,8 @@ usage() { echo " -d, --deployment-name DEPLOYMENT_NAME Name of the deployment from a 'deploy-azure.sh' deployment (mandatory)" echo " -a, --application-id APPLICATION_ID Client application ID (mandatory)" echo " -au, --authority Authority to use for client applications that are not configured as multi-tenant. Defaults to (https://login.microsoftonline.com/common) if not specified." + echo " -v --version VERSION Version to set files to (default: 1.0.0)" + echo " -i --info INFO Additional info to put in version details" echo " -nr, --no-redirect Do not attempt to register redirect URIs with the client application" } @@ -47,6 +49,16 @@ while [[ $# -gt 0 ]]; do shift shift ;; + -v|--version) + VERSION="$2" + shift + shift + ;; + -i|--info) + INFO="$2" + shift + shift + ;; -nr|--no-redirect) NO_REDIRECT=true shift @@ -97,6 +109,8 @@ echo "REACT_APP_BACKEND_URI=https://$WEB_API_URL/" > $ENV_FILE_PATH echo "REACT_APP_AAD_AUTHORITY=$AUTHORITY" >> $ENV_FILE_PATH echo "REACT_APP_AAD_CLIENT_ID=$APPLICATION_ID" >> $ENV_FILE_PATH echo "REACT_APP_SK_API_KEY=$WEB_API_KEY" >> $ENV_FILE_PATH +echo "REACT_APP_SK_VERSION=$VERSION" >> $ENV_FILE_PATH +echo "REACT_APP_SK_BUILD_INFO=$INFO" >> $ENV_FILE_PATH echo "Writing swa-cli.config.json..." SWA_CONFIG_FILE_PATH="$SCRIPT_ROOT/../../webapp/swa-cli.config.json" diff --git a/scripts/deploy/package-webapi.ps1 b/scripts/deploy/package-webapi.ps1 index 81ae21ccf..c02f7c00b 100755 --- a/scripts/deploy/package-webapi.ps1 +++ b/scripts/deploy/package-webapi.ps1 @@ -19,6 +19,14 @@ param( [string] # Output directory for published assets. $OutputDirectory = "$PSScriptRoot" + + [string] + # Version to give to assemblies and files. + $Version = "1.0.0" + + [string] + # Additional information given in version info. + $InformationalVersion = "" ) Write-Host "BuildConfiguration: $BuildConfiguration" @@ -37,7 +45,7 @@ if (!(Test-Path $publishOutputDirectory)) { } Write-Host "Build configuration: $BuildConfiguration" -dotnet publish "$PSScriptRoot/../../webapi/CopilotChatWebApi.csproj" --configuration $BuildConfiguration --framework $DotNetFramework --runtime $TargetRuntime --self-contained --output "$publishOutputDirectory" +dotnet publish "$PSScriptRoot/../../webapi/CopilotChatWebApi.csproj" --configuration $BuildConfiguration --framework $DotNetFramework --runtime $TargetRuntime --self-contained --output "$publishOutputDirectory" /p:AssemblyVersion=$Version /p:FileVersion=$Version /p:InformationalVersion=$InformationalVersion if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/scripts/deploy/package-webapi.sh b/scripts/deploy/package-webapi.sh index f4fe48f19..972ff86fd 100644 --- a/scripts/deploy/package-webapi.sh +++ b/scripts/deploy/package-webapi.sh @@ -14,7 +14,9 @@ usage() { echo " -c, --configuration CONFIGURATION Build configuration (default: Release)" echo " -d, --dotnet DOTNET_FRAMEWORK_VERSION Target dotnet framework (default: net6.0)" echo " -r, --runtime TARGET_RUNTIME Runtime identifier (default: linux-x64)" - echo " -p, --output OUTPUT_DIRECTORY Output directory (default: $SCRIPT_ROOT)" + echo " -o, --output OUTPUT_DIRECTORY Output directory (default: $SCRIPT_ROOT)" + echo " -v --version VERSION Version to set files to (default: 1.0.0)" + echo " -i --info INFO Additional info to put in version details" echo " -nz, --no-zip Do not zip package (default: false)" } @@ -42,6 +44,16 @@ while [[ $# -gt 0 ]]; do shift shift ;; + -v|--version) + VERSION="$2" + shift + shift + ;; + -i|--info) + INFO="$2" + shift + shift + ;; -nz|--no-zip) NO_ZIP=true shift @@ -58,6 +70,8 @@ done : "${CONFIGURATION:="Release"}" : "${DOTNET:="net6.0"}" : "${RUNTIME:="linux-x64"}" +: "${VERSION:="1.0.0"}" +: "${INFO:=""}" : "${OUTPUT_DIRECTORY:="$SCRIPT_ROOT"}" PUBLISH_OUTPUT_DIRECTORY="$OUTPUT_DIRECTORY/publish" @@ -72,7 +86,7 @@ if [[ ! -d "$PUBLISH_ZIP_DIRECTORY" ]]; then fi echo "Build configuration: $CONFIGURATION" -dotnet publish "$SCRIPT_ROOT/../../webapi/CopilotChatWebApi.csproj" --configuration $CONFIGURATION --framework $DOTNET --runtime $RUNTIME --self-contained --output "$PUBLISH_OUTPUT_DIRECTORY" +dotnet publish "$SCRIPT_ROOT/../../webapi/CopilotChatWebApi.csproj" --configuration $CONFIGURATION --framework $DOTNET --runtime $RUNTIME --self-contained --output "$PUBLISH_OUTPUT_DIRECTORY" /p:AssemblyVersion=$VERSION /p:FileVersion=$VERSION /p:InformationalVersion=$INFO if [ $? -ne 0 ]; then exit 1 fi diff --git a/webapi/Controllers/ServiceOptionsController.cs b/webapi/Controllers/ServiceOptionsController.cs index 28adf3758..5380a4916 100644 --- a/webapi/Controllers/ServiceOptionsController.cs +++ b/webapi/Controllers/ServiceOptionsController.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. -using System; +using System.Diagnostics; +using System.Reflection; using CopilotChat.WebApi.Models.Response; using CopilotChat.WebApi.Options; using Microsoft.AspNetCore.Authorization; @@ -34,20 +35,24 @@ public ServiceOptionsController( /// /// Return the memory store type that is configured. /// - [Route("serviceOptions")] + [Route("ServiceOptions")] [HttpGet] [ProducesResponseType(StatusCodes.Status200OK)] public IActionResult GetServiceOptions() { - return this.Ok( - new ServiceOptionsResponse() - { - MemoryStore = new MemoryStoreOptionResponse() - { - Types = Enum.GetNames(typeof(MemoryStoreOptions.MemoryStoreType)), - SelectedType = this._memoryStoreOptions.Type.ToString() - } - } - ); + var response = new ServiceOptionsResponse(); + + response.Values.Add("memoryStore", this._memoryStoreOptions.Type.ToString()); + response.Values.Add("version", GetAssemblyFileVersion()); + + return this.Ok(response); + } + + private static string GetAssemblyFileVersion() + { + Assembly assembly = Assembly.GetExecutingAssembly(); + FileVersionInfo fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location); + + return fileVersion.FileVersion ?? string.Empty; } } diff --git a/webapi/Models/Response/ServiceOptionsResponse.cs b/webapi/Models/Response/ServiceOptionsResponse.cs index d5eda9cba..d6fe440fa 100644 --- a/webapi/Models/Response/ServiceOptionsResponse.cs +++ b/webapi/Models/Response/ServiceOptionsResponse.cs @@ -1,34 +1,18 @@ // Copyright (c) Microsoft. All rights reserved. using System.Collections.Generic; -using System.Linq; using System.Text.Json.Serialization; namespace CopilotChat.WebApi.Models.Response; -public class ServiceOptionsResponse -{ - /// - /// Configured memory store. - /// - [JsonPropertyName("memoryStore")] - public MemoryStoreOptionResponse MemoryStore { get; set; } = new MemoryStoreOptionResponse(); -} - /// -/// Response to memoryStoreType request. +/// Response given by /// -public class MemoryStoreOptionResponse +public class ServiceOptionsResponse { /// - /// All the available memory store types. - /// - [JsonPropertyName("types")] - public IEnumerable Types { get; set; } = Enumerable.Empty(); - - /// - /// The selected memory store type. + /// Dictionary of values to return to caller. /// - [JsonPropertyName("selectedType")] - public string SelectedType { get; set; } = string.Empty; + [JsonPropertyName("values")] + public Dictionary Values { get; set; } = new(); } diff --git a/webapp/src/components/chat/tabs/DocumentsTab.tsx b/webapp/src/components/chat/tabs/DocumentsTab.tsx index fd0afefd3..7e8fada20 100644 --- a/webapp/src/components/chat/tabs/DocumentsTab.tsx +++ b/webapp/src/components/chat/tabs/DocumentsTab.tsx @@ -4,8 +4,6 @@ import { Button, Label, ProgressBar, - Radio, - RadioGroup, Spinner, Table, TableBody, @@ -180,19 +178,8 @@ export const DocumentsTab: React.FC = () => { {importingDocuments && importingDocuments.length > 0 && } {/* Hardcode vector database as we don't support switching vector store dynamically now. */}
- - - {serviceOptions.memoryStore.types.map((storeType) => { - return ( - - ); - })} - + +
diff --git a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx index 9b82bcc32..f9cf76931 100644 --- a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx +++ b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx @@ -56,7 +56,7 @@ interface ISettingsDialogProps { export const SettingsDialog: React.FC = ({ open, closeDialog }) => { const classes = useClasses(); const dialogClasses = useDialogClasses(); - const { settings, tokenUsage } = useAppSelector((state: RootState) => state.app); + const { serviceOptions, settings, tokenUsage } = useAppSelector((state: RootState) => state.app); return ( = ({ open, closeDial })} + + + +

About

+
+ + + Frontend version: {process.env.REACT_APP_SK_VERSION}
+ {process.env.REACT_APP_SK_BUILD_INFO}
+ Backend version: {serviceOptions.values.version} +
+
+
diff --git a/webapp/src/libs/models/ServiceOptions.ts b/webapp/src/libs/models/ServiceOptions.ts index f275ba5fb..34b939cf4 100644 --- a/webapp/src/libs/models/ServiceOptions.ts +++ b/webapp/src/libs/models/ServiceOptions.ts @@ -1,10 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -export interface MemoryStore { - types: string[]; - selectedType: string; -} - export interface ServiceOptions { - memoryStore: MemoryStore; + values: { [key: string]: string }; } diff --git a/webapp/src/libs/services/ChatService.ts b/webapp/src/libs/services/ChatService.ts index 3183e0bd3..936eb7b56 100644 --- a/webapp/src/libs/services/ChatService.ts +++ b/webapp/src/libs/services/ChatService.ts @@ -241,7 +241,7 @@ export class ChatService extends BaseService { public getServiceOptionsAsync = async (accessToken: string): Promise => { const result = await this.getResponseAsync( { - commandPath: `serviceOptions`, + commandPath: `ServiceOptions`, method: 'GET', }, accessToken, diff --git a/webapp/src/redux/features/app/AppState.ts b/webapp/src/redux/features/app/AppState.ts index 1baa327ba..00b5c9e4f 100644 --- a/webapp/src/redux/features/app/AppState.ts +++ b/webapp/src/redux/features/app/AppState.ts @@ -134,5 +134,5 @@ export const initialState: AppState = { tokenUsage: {}, features: Features, settings: Settings, - serviceOptions: { memoryStore: { types: [], selectedType: '' } }, + serviceOptions: { values: {} }, }; From 3f191702a377239a54e2c73c2db6ee3b50c3818a Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Mon, 14 Aug 2023 22:56:00 -0700 Subject: [PATCH 02/10] Address PR comments --- .github/workflows/copilot-deploy-frontend.yml | 2 +- scripts/deploy/deploy-webapp.ps1 | 8 ++--- scripts/deploy/package-webapi.ps1 | 4 +-- .../Controllers/ServiceOptionsController.cs | 16 +++++++--- .../Models/Response/ServiceOptionsResponse.cs | 32 ++++++++++++++++--- .../src/components/chat/tabs/DocumentsTab.tsx | 17 ++++++++-- .../header/settings-dialog/SettingsDialog.tsx | 4 +-- webapp/src/libs/models/ServiceOptions.ts | 8 ++++- webapp/src/libs/services/ChatService.ts | 2 +- webapp/src/redux/features/app/AppState.ts | 2 +- 10 files changed, 71 insertions(+), 24 deletions(-) diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index a00f0e180..86aab1ae8 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -92,4 +92,4 @@ jobs: - name: Deploy SWA run: | - scripts/deploy/deploy-webapp.sh --Subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect -version ${{ steps.versiontag.outputs.versiontag }} -informational_version "Commit steps.gitversion.outputs.ShortSha" + scripts/deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect -version ${{ steps.versiontag.outputs.versiontag }} -informational_version "Commit steps.gitversion.outputs.ShortSha" diff --git a/scripts/deploy/deploy-webapp.ps1 b/scripts/deploy/deploy-webapp.ps1 index b120c01fd..fa4bed906 100644 --- a/scripts/deploy/deploy-webapp.ps1 +++ b/scripts/deploy/deploy-webapp.ps1 @@ -27,11 +27,11 @@ param( [Parameter(Mandatory=$false)] [string] # Authority for client applications that are not configured as multi-tenant. - $Authority="https://login.microsoftonline.com/common" + $Authority="https://login.microsoftonline.com/common", [string] # Version to display in UI. - $Version = "" + $Version = "", [string] # Additional information given in version info. @@ -72,8 +72,8 @@ Write-Host "Writing environment variables to '$envFilePath'..." "REACT_APP_AAD_AUTHORITY=$Authority" | Out-File -FilePath $envFilePath -Append "REACT_APP_AAD_CLIENT_ID=$ApplicationClientId" | Out-File -FilePath $envFilePath -Append "REACT_APP_SK_API_KEY=$webapiApiKey" | Out-File -FilePath $envFilePath -Append -"REACT_APP_SK_VERSION=$Version" | Out-File -FilePat -"REACT_APP_SK_BUILD_INFO=$InformationalVersion" | Out-File -FilePat +"REACT_APP_SK_VERSION=$Version" | Out-File -FilePath $envFilePath -Append +"REACT_APP_SK_BUILD_INFO=$InformationalVersion" | Out-File -FilePath $envFilePath -Append Write-Host "Generating SWA config..." $swaConfig = $(Get-Content "$PSScriptRoot/../../webapp/template.swa-cli.config.json" -Raw) diff --git a/scripts/deploy/package-webapi.ps1 b/scripts/deploy/package-webapi.ps1 index c02f7c00b..586570751 100755 --- a/scripts/deploy/package-webapi.ps1 +++ b/scripts/deploy/package-webapi.ps1 @@ -18,11 +18,11 @@ param( [string] # Output directory for published assets. - $OutputDirectory = "$PSScriptRoot" + $OutputDirectory = "$PSScriptRoot", [string] # Version to give to assemblies and files. - $Version = "1.0.0" + $Version = "1.0.0", [string] # Additional information given in version info. diff --git a/webapi/Controllers/ServiceOptionsController.cs b/webapi/Controllers/ServiceOptionsController.cs index 5380a4916..e0dd66e5a 100644 --- a/webapi/Controllers/ServiceOptionsController.cs +++ b/webapi/Controllers/ServiceOptionsController.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Diagnostics; using System.Reflection; using CopilotChat.WebApi.Models.Response; @@ -35,15 +36,20 @@ public ServiceOptionsController( /// /// Return the memory store type that is configured. /// - [Route("ServiceOptions")] + [Route("serviceOptions")] [HttpGet] [ProducesResponseType(StatusCodes.Status200OK)] public IActionResult GetServiceOptions() { - var response = new ServiceOptionsResponse(); - - response.Values.Add("memoryStore", this._memoryStoreOptions.Type.ToString()); - response.Values.Add("version", GetAssemblyFileVersion()); + var response = new ServiceOptionsResponse() + { + MemoryStore = new MemoryStoreOptionResponse() + { + Types = Enum.GetNames(typeof(MemoryStoreOptions.MemoryStoreType)), + SelectedType = this._memoryStoreOptions.Type.ToString() + }, + Version = GetAssemblyFileVersion() + }; return this.Ok(response); } diff --git a/webapi/Models/Response/ServiceOptionsResponse.cs b/webapi/Models/Response/ServiceOptionsResponse.cs index d6fe440fa..dad1cb091 100644 --- a/webapi/Models/Response/ServiceOptionsResponse.cs +++ b/webapi/Models/Response/ServiceOptionsResponse.cs @@ -1,18 +1,40 @@ // Copyright (c) Microsoft. All rights reserved. using System.Collections.Generic; +using System.Linq; using System.Text.Json.Serialization; namespace CopilotChat.WebApi.Models.Response; +public class ServiceOptionsResponse +{ + /// + /// Configured memory store. + /// + [JsonPropertyName("memoryStore")] + public MemoryStoreOptionResponse MemoryStore { get; set; } = new MemoryStoreOptionResponse(); + + /// + /// Version of this application. + /// + [JsonPropertyName("version")] + public string Version { get; set; } = string.Empty; +} + /// -/// Response given by +/// Response to memoryStoreType request. /// -public class ServiceOptionsResponse +public class MemoryStoreOptionResponse { /// - /// Dictionary of values to return to caller. + /// All the available memory store types. + /// + [JsonPropertyName("types")] + public IEnumerable Types { get; set; } = Enumerable.Empty(); + + /// + /// The selected memory store type. /// - [JsonPropertyName("values")] - public Dictionary Values { get; set; } = new(); + [JsonPropertyName("selectedType")] + public string SelectedType { get; set; } = string.Empty; } diff --git a/webapp/src/components/chat/tabs/DocumentsTab.tsx b/webapp/src/components/chat/tabs/DocumentsTab.tsx index 7e8fada20..fd0afefd3 100644 --- a/webapp/src/components/chat/tabs/DocumentsTab.tsx +++ b/webapp/src/components/chat/tabs/DocumentsTab.tsx @@ -4,6 +4,8 @@ import { Button, Label, ProgressBar, + Radio, + RadioGroup, Spinner, Table, TableBody, @@ -178,8 +180,19 @@ export const DocumentsTab: React.FC = () => { {importingDocuments && importingDocuments.length > 0 && } {/* Hardcode vector database as we don't support switching vector store dynamically now. */}
- - + + + {serviceOptions.memoryStore.types.map((storeType) => { + return ( + + ); + })} +
diff --git a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx index f9cf76931..97445527f 100644 --- a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx +++ b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx @@ -100,9 +100,9 @@ export const SettingsDialog: React.FC = ({ open, closeDial - Frontend version: {process.env.REACT_APP_SK_VERSION}
+ Frontend version: {process.env.REACT_APP_SK_VERSION ?? "-"}
{process.env.REACT_APP_SK_BUILD_INFO}
- Backend version: {serviceOptions.values.version} + Backend version: {serviceOptions.version}
diff --git a/webapp/src/libs/models/ServiceOptions.ts b/webapp/src/libs/models/ServiceOptions.ts index 34b939cf4..b5335f6f3 100644 --- a/webapp/src/libs/models/ServiceOptions.ts +++ b/webapp/src/libs/models/ServiceOptions.ts @@ -1,5 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. +export interface MemoryStore { + types: string[]; + selectedType: string; +} + export interface ServiceOptions { - values: { [key: string]: string }; + memoryStore: MemoryStore; + version: string; } diff --git a/webapp/src/libs/services/ChatService.ts b/webapp/src/libs/services/ChatService.ts index 936eb7b56..3183e0bd3 100644 --- a/webapp/src/libs/services/ChatService.ts +++ b/webapp/src/libs/services/ChatService.ts @@ -241,7 +241,7 @@ export class ChatService extends BaseService { public getServiceOptionsAsync = async (accessToken: string): Promise => { const result = await this.getResponseAsync( { - commandPath: `ServiceOptions`, + commandPath: `serviceOptions`, method: 'GET', }, accessToken, diff --git a/webapp/src/redux/features/app/AppState.ts b/webapp/src/redux/features/app/AppState.ts index 00b5c9e4f..9634ba1d2 100644 --- a/webapp/src/redux/features/app/AppState.ts +++ b/webapp/src/redux/features/app/AppState.ts @@ -134,5 +134,5 @@ export const initialState: AppState = { tokenUsage: {}, features: Features, settings: Settings, - serviceOptions: { values: {} }, + serviceOptions: { memoryStore: { types: [], selectedType: '' }, version: '' }, }; From 8ef843cbc1bee278484fc9c7fc9bbfb27cf913e4 Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Mon, 14 Aug 2023 23:11:54 -0700 Subject: [PATCH 03/10] Fix usage of GitVersion --- .github/workflows/copilot-build-backend.yml | 4 +--- .github/workflows/copilot-deploy-frontend.yml | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/copilot-build-backend.yml b/.github/workflows/copilot-build-backend.yml index 96bdf34ee..c39742264 100644 --- a/.github/workflows/copilot-build-backend.yml +++ b/.github/workflows/copilot-build-backend.yml @@ -40,11 +40,9 @@ jobs: with: versionSpec: '5.x' - - name: Display GitVersion config + - name: Determine version id: gitversion uses: gittools/actions/gitversion/execute@v0 - with: - additionalArguments: '/showConfig' - name: Set version tag id: versiontag diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index 86aab1ae8..e9db5efb7 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -74,11 +74,9 @@ jobs: with: versionSpec: '5.x' - - name: Display GitVersion config + - name: Determine version id: gitversion uses: gittools/actions/gitversion/execute@v0 - with: - additionalArguments: '/showConfig' - name: Set version tag id: versiontag From 8fb2e798d7d258191fa56639214fc3bd4105c178 Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Mon, 14 Aug 2023 23:31:23 -0700 Subject: [PATCH 04/10] Do full-depth checkouts for GitVersion to output meaningful data --- .github/workflows/copilot-build-backend.yml | 1 + .github/workflows/copilot-deploy-frontend.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/copilot-build-backend.yml b/.github/workflows/copilot-build-backend.yml index c39742264..0f591fb72 100644 --- a/.github/workflows/copilot-build-backend.yml +++ b/.github/workflows/copilot-build-backend.yml @@ -34,6 +34,7 @@ jobs: - uses: actions/checkout@v3 with: clean: true + fetch-depth: 0 - name: Install GitVersion uses: gittools/actions/gitversion/setup@v0 diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index e9db5efb7..fa84f9018 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -38,6 +38,7 @@ jobs: - uses: actions/checkout@v3 with: clean: true + fetch-depth: 0 - name: Install Azure CLI run: | From a8dd56b47b146f55c1900c944edc30850502a2a7 Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Tue, 15 Aug 2023 00:27:21 -0700 Subject: [PATCH 05/10] Taking GitVersion out of the equation --- .github/workflows/copilot-build-backend.yml | 21 +++++++------------ .../workflows/copilot-deploy-environment.yml | 4 ++++ .github/workflows/copilot-deploy-frontend.yml | 20 ++++++------------ .github/workflows/copilot-deploy-pipeline.yml | 7 +++++++ 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/workflows/copilot-build-backend.yml b/.github/workflows/copilot-build-backend.yml index 0f591fb72..1a0427833 100644 --- a/.github/workflows/copilot-build-backend.yml +++ b/.github/workflows/copilot-build-backend.yml @@ -6,6 +6,10 @@ on: paths: - "webapi/**" workflow_call: + inputs: + MAJOR_MINOR: + required: true + type: string outputs: artifact: description: "The name of the uploaded artifact." @@ -34,30 +38,19 @@ jobs: - uses: actions/checkout@v3 with: clean: true - fetch-depth: 0 - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0 - with: - versionSpec: '5.x' - - - name: Determine version - id: gitversion - uses: gittools/actions/gitversion/execute@v0 - name: Set version tag id: versiontag run: | - $VERSION_TAG = "${{ steps.gitversion.outputs.Major }}." - $VERSION_TAG += "${{ steps.gitversion.outputs.Minor }}." + $VERSION_TAG = ${{ inputs.MAJOR_MINOR }} $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." - $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}" + $VERSION_TAG += "${{ github.run_attempt }}" echo $VERSION_TAG Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT - name: Package Copilot Chat WebAPI run: | - scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy -Version ${{ steps.versiontag.outputs.versiontag }} -InformationalVersion "Commit steps.gitversion.outputs.ShortSha" + scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy -Version ${{ steps.versiontag.outputs.versiontag }} -InformationalVersion "Commit ${{ github.sha }}" - name: Check formatting of Copilot Chat WebAPI run: | diff --git a/.github/workflows/copilot-deploy-environment.yml b/.github/workflows/copilot-deploy-environment.yml index a8665718f..be8733298 100644 --- a/.github/workflows/copilot-deploy-environment.yml +++ b/.github/workflows/copilot-deploy-environment.yml @@ -9,6 +9,9 @@ on: ARTIFACT_NAME: required: true type: string + MAJOR_MINOR: + required: true + type: string secrets: AZURE_CLIENT_ID: required: true @@ -57,6 +60,7 @@ jobs: with: DEPLOYMENT_NAME: ${{needs.deploy-infra.outputs.deployment-id}} ENVIRONMENT: ${{inputs.ENVIRONMENT}} + MAJOR_MINOR: ${{inputs.MAJOR_MINOR}} secrets: AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index fa84f9018..96796a2d8 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -9,6 +9,9 @@ on: DEPLOYMENT_NAME: required: true type: string + MAJOR_MINOR: + required: true + type: string secrets: AZURE_CLIENT_ID: required: true @@ -38,7 +41,6 @@ jobs: - uses: actions/checkout@v3 with: clean: true - fetch-depth: 0 - name: Install Azure CLI run: | @@ -70,25 +72,15 @@ jobs: echo "::add-mask::$swaToken" echo "SWA_CLI_DEPLOYMENT_TOKEN=$swaToken" >> $GITHUB_ENV - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0 - with: - versionSpec: '5.x' - - - name: Determine version - id: gitversion - uses: gittools/actions/gitversion/execute@v0 - - name: Set version tag id: versiontag run: | - $VERSION_TAG = "${{ steps.gitversion.outputs.Major }}." - $VERSION_TAG += "${{ steps.gitversion.outputs.Minor }}." + $VERSION_TAG = ${{ inputs.MAJOR_MINOR }} $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." - $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}" + $VERSION_TAG += "${{ github.run_attempt }}" echo $VERSION_TAG Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT - name: Deploy SWA run: | - scripts/deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect -version ${{ steps.versiontag.outputs.versiontag }} -informational_version "Commit steps.gitversion.outputs.ShortSha" + scripts/deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect -version ${{ steps.versiontag.outputs.versiontag }} -informational_version "Commit ${{ github.sha }}" diff --git a/.github/workflows/copilot-deploy-pipeline.yml b/.github/workflows/copilot-deploy-pipeline.yml index 63a07437c..d0c3d546e 100644 --- a/.github/workflows/copilot-deploy-pipeline.yml +++ b/.github/workflows/copilot-deploy-pipeline.yml @@ -5,6 +5,9 @@ on: push: branches: ["main"] +env: + MAJOR_MINOR: "0.1" + concurrency: group: ${{ github.workflow }} cancel-in-progress: true @@ -16,6 +19,8 @@ permissions: jobs: build: uses: ./.github/workflows/copilot-build-backend.yml + with: + MAJOR_MINOR: ${{ $MAJOR_MINOR }} int: needs: build @@ -23,6 +28,7 @@ jobs: with: ENVIRONMENT: int ARTIFACT_NAME: ${{needs.build.outputs.artifact}} + MAJOR_MINOR: ${{ $MAJOR_MINOR }} secrets: AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} @@ -37,6 +43,7 @@ jobs: with: ENVIRONMENT: stable ARTIFACT_NAME: ${{needs.build.outputs.artifact}} + MAJOR_MINOR: ${{ $MAJOR_MINOR }} secrets: AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} From 4fd8a18d25c18612f4dffeb19a6012e8b223fd89 Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Tue, 15 Aug 2023 11:36:47 -0700 Subject: [PATCH 06/10] Update webapp/src/components/header/settings-dialog/SettingsDialog.tsx Co-authored-by: Teresa Hoang <125500434+teresaqhoang@users.noreply.github.com> --- webapp/src/components/header/settings-dialog/SettingsDialog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx index 97445527f..dca13b359 100644 --- a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx +++ b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx @@ -106,6 +106,7 @@ export const SettingsDialog: React.FC = ({ open, closeDial + From e7b979a9507f66ffc808b3af0b3312c5bba69d34 Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Tue, 15 Aug 2023 11:38:57 -0700 Subject: [PATCH 07/10] Address further PR comments and fiddle with workflows --- .github/workflows/copilot-build-backend.yml | 2 +- .github/workflows/copilot-deploy-frontend.yml | 2 +- .github/workflows/copilot-deploy-pipeline.yml | 4 ++-- scripts/deploy/deploy-webapp.ps1 | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/copilot-build-backend.yml b/.github/workflows/copilot-build-backend.yml index 1a0427833..dd2fa901f 100644 --- a/.github/workflows/copilot-build-backend.yml +++ b/.github/workflows/copilot-build-backend.yml @@ -44,7 +44,7 @@ jobs: run: | $VERSION_TAG = ${{ inputs.MAJOR_MINOR }} $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." - $VERSION_TAG += "${{ github.run_attempt }}" + $VERSION_TAG += "${{ github.run_number }}" echo $VERSION_TAG Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index 96796a2d8..2494763a0 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -77,7 +77,7 @@ jobs: run: | $VERSION_TAG = ${{ inputs.MAJOR_MINOR }} $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." - $VERSION_TAG += "${{ github.run_attempt }}" + $VERSION_TAG += "${{ github.run_number }}" echo $VERSION_TAG Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT diff --git a/.github/workflows/copilot-deploy-pipeline.yml b/.github/workflows/copilot-deploy-pipeline.yml index d0c3d546e..a6b7bc594 100644 --- a/.github/workflows/copilot-deploy-pipeline.yml +++ b/.github/workflows/copilot-deploy-pipeline.yml @@ -6,7 +6,7 @@ on: branches: ["main"] env: - MAJOR_MINOR: "0.1" + MAJOR_MINOR: '0.1' concurrency: group: ${{ github.workflow }} @@ -20,7 +20,7 @@ jobs: build: uses: ./.github/workflows/copilot-build-backend.yml with: - MAJOR_MINOR: ${{ $MAJOR_MINOR }} + MAJOR_MINOR: ${{ env.MAJOR_MINOR }} int: needs: build diff --git a/scripts/deploy/deploy-webapp.ps1 b/scripts/deploy/deploy-webapp.ps1 index fa4bed906..e1e1e802c 100644 --- a/scripts/deploy/deploy-webapp.ps1 +++ b/scripts/deploy/deploy-webapp.ps1 @@ -34,7 +34,7 @@ param( $Version = "", [string] - # Additional information given in version info. + # Additional information given in version info. (Ex: commit SHA) $InformationalVersion = "" ) From 9e1bfbac74dc21572be8b0bf09e98a858f6373a0 Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Tue, 15 Aug 2023 15:54:16 -0700 Subject: [PATCH 08/10] More PR comments addressed --- .github/workflows/copilot-build-backend.yml | 6 ++-- .github/workflows/copilot-build-frontend.yml | 35 +++++++++++++++++++ .../workflows/copilot-deploy-environment.yml | 4 +-- .github/workflows/copilot-deploy-frontend.yml | 4 +-- .github/workflows/copilot-deploy-pipeline.yml | 8 ++--- .github/workflows/typos.yaml | 29 +++++++++++++++ scripts/deploy/deploy-webapp.sh | 2 +- .../header/settings-dialog/SettingsDialog.tsx | 4 +-- 8 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/copilot-build-frontend.yml create mode 100644 .github/workflows/typos.yaml diff --git a/.github/workflows/copilot-build-backend.yml b/.github/workflows/copilot-build-backend.yml index dd2fa901f..810543cd6 100644 --- a/.github/workflows/copilot-build-backend.yml +++ b/.github/workflows/copilot-build-backend.yml @@ -7,7 +7,7 @@ on: - "webapi/**" workflow_call: inputs: - MAJOR_MINOR: + VERSION: # Major and minor (ex: 1.0) part of a version string required: true type: string outputs: @@ -41,8 +41,8 @@ jobs: - name: Set version tag id: versiontag - run: | - $VERSION_TAG = ${{ inputs.MAJOR_MINOR }} + run: | # Start with inputs.VERSION if provided, or '0.0' otherwise + $VERSION_TAG = ${{inputs.VERSION != '' && inputs.VERSION || '0.0'}} $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." $VERSION_TAG += "${{ github.run_number }}" echo $VERSION_TAG diff --git a/.github/workflows/copilot-build-frontend.yml b/.github/workflows/copilot-build-frontend.yml new file mode 100644 index 000000000..7c8fb46ce --- /dev/null +++ b/.github/workflows/copilot-build-frontend.yml @@ -0,0 +1,35 @@ +name: copilot-build-frontend + +on: + workflow_dispatch: + pull_request: + branches: ["main"] + paths: + - "webapp/**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + webapp: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: "yarn" + cache-dependency-path: "webapp/yarn.lock" + + - name: Run yarn install, yarn build, & yarn format + run: | + #!/bin/bash + set -e # exit with nonzero exit code if anything fails + echo "Running yarn install, yarn build, & yarn format" + yarn install --frozen-lockfile # install dependencies and ensure lockfile is unchanged. + yarn build # run build script + yarn format # run format script + working-directory: webapp diff --git a/.github/workflows/copilot-deploy-environment.yml b/.github/workflows/copilot-deploy-environment.yml index be8733298..73eb59121 100644 --- a/.github/workflows/copilot-deploy-environment.yml +++ b/.github/workflows/copilot-deploy-environment.yml @@ -9,7 +9,7 @@ on: ARTIFACT_NAME: required: true type: string - MAJOR_MINOR: + VERSION: # Major and minor (ex: 1.0) part of a version string required: true type: string secrets: @@ -60,7 +60,7 @@ jobs: with: DEPLOYMENT_NAME: ${{needs.deploy-infra.outputs.deployment-id}} ENVIRONMENT: ${{inputs.ENVIRONMENT}} - MAJOR_MINOR: ${{inputs.MAJOR_MINOR}} + VERSION: ${{inputs.VERSION}} secrets: AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index 2494763a0..0e243a3bb 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -9,7 +9,7 @@ on: DEPLOYMENT_NAME: required: true type: string - MAJOR_MINOR: + VERSION: # Major and minor (ex: 1.0) part of a version string required: true type: string secrets: @@ -75,7 +75,7 @@ jobs: - name: Set version tag id: versiontag run: | - $VERSION_TAG = ${{ inputs.MAJOR_MINOR }} + $VERSION_TAG = ${{ inputs.VERSION }} $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." $VERSION_TAG += "${{ github.run_number }}" echo $VERSION_TAG diff --git a/.github/workflows/copilot-deploy-pipeline.yml b/.github/workflows/copilot-deploy-pipeline.yml index a6b7bc594..4454cb79f 100644 --- a/.github/workflows/copilot-deploy-pipeline.yml +++ b/.github/workflows/copilot-deploy-pipeline.yml @@ -6,7 +6,7 @@ on: branches: ["main"] env: - MAJOR_MINOR: '0.1' + VERSION: '0.1' concurrency: group: ${{ github.workflow }} @@ -20,7 +20,7 @@ jobs: build: uses: ./.github/workflows/copilot-build-backend.yml with: - MAJOR_MINOR: ${{ env.MAJOR_MINOR }} + VERSION: ${{env.VERSION}} int: needs: build @@ -28,7 +28,7 @@ jobs: with: ENVIRONMENT: int ARTIFACT_NAME: ${{needs.build.outputs.artifact}} - MAJOR_MINOR: ${{ $MAJOR_MINOR }} + VERSION: ${{env.VERSION}} secrets: AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} @@ -43,7 +43,7 @@ jobs: with: ENVIRONMENT: stable ARTIFACT_NAME: ${{needs.build.outputs.artifact}} - MAJOR_MINOR: ${{ $MAJOR_MINOR }} + VERSION: ${{ $VERSION }} secrets: AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} diff --git a/.github/workflows/typos.yaml b/.github/workflows/typos.yaml new file mode 100644 index 000000000..1d2b0df54 --- /dev/null +++ b/.github/workflows/typos.yaml @@ -0,0 +1,29 @@ +# Check pull requests for typos. +# +# Configuration: .github/_typos.toml +# +# Info: https://github.com/marketplace/actions/typos-action +# Local install: brew install typos-cli +# Local install: conda install typos +# Local run: typos -c .github/_typos.toml + +name: Spell Check + +on: + workflow_dispatch: + pull_request: + branches: [ "main", "feature*" ] + +jobs: + run: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Use custom config file + uses: crate-ci/typos@master + with: + config: .github/_typos.toml + write_changes: false diff --git a/scripts/deploy/deploy-webapp.sh b/scripts/deploy/deploy-webapp.sh index c206ada33..2d428d661 100755 --- a/scripts/deploy/deploy-webapp.sh +++ b/scripts/deploy/deploy-webapp.sh @@ -15,7 +15,7 @@ usage() { echo " -d, --deployment-name DEPLOYMENT_NAME Name of the deployment from a 'deploy-azure.sh' deployment (mandatory)" echo " -a, --application-id APPLICATION_ID Client application ID (mandatory)" echo " -au, --authority Authority to use for client applications that are not configured as multi-tenant. Defaults to (https://login.microsoftonline.com/common) if not specified." - echo " -v --version VERSION Version to set files to (default: 1.0.0)" + echo " -v --version VERSION Version to display in UI (default: 1.0.0)" echo " -i --info INFO Additional info to put in version details" echo " -nr, --no-redirect Do not attempt to register redirect URIs with the client application" } diff --git a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx index dca13b359..ee8bdce94 100644 --- a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx +++ b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx @@ -100,9 +100,9 @@ export const SettingsDialog: React.FC = ({ open, closeDial + Backend version: {serviceOptions.version}
Frontend version: {process.env.REACT_APP_SK_VERSION ?? "-"}
- {process.env.REACT_APP_SK_BUILD_INFO}
- Backend version: {serviceOptions.version} + {process.env.REACT_APP_SK_BUILD_INFO}
From 7fe8587adfc3686fe5f5bfdd70a77750c2f0e3aa Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Tue, 15 Aug 2023 18:37:07 -0700 Subject: [PATCH 09/10] Bring GitVersion back in --- .github/workflows/copilot-build-backend.yml | 23 ++++++++++++------- .../workflows/copilot-deploy-environment.yml | 4 ---- .github/workflows/copilot-deploy-frontend.yml | 20 +++++++++++----- .github/workflows/copilot-deploy-pipeline.yml | 7 ------ scripts/deploy/deploy-webapp.ps1 | 4 ++-- scripts/deploy/deploy-webapp.sh | 8 +++---- 6 files changed, 35 insertions(+), 31 deletions(-) diff --git a/.github/workflows/copilot-build-backend.yml b/.github/workflows/copilot-build-backend.yml index 810543cd6..a8582214d 100644 --- a/.github/workflows/copilot-build-backend.yml +++ b/.github/workflows/copilot-build-backend.yml @@ -6,10 +6,6 @@ on: paths: - "webapi/**" workflow_call: - inputs: - VERSION: # Major and minor (ex: 1.0) part of a version string - required: true - type: string outputs: artifact: description: "The name of the uploaded artifact." @@ -38,19 +34,30 @@ jobs: - uses: actions/checkout@v3 with: clean: true + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: '5.x' + + - name: Determine version + id: gitversion + uses: gittools/actions/gitversion/execute@v0 - name: Set version tag id: versiontag - run: | # Start with inputs.VERSION if provided, or '0.0' otherwise - $VERSION_TAG = ${{inputs.VERSION != '' && inputs.VERSION || '0.0'}} + run: | + $VERSION_TAG = "${{ steps.gitversion.outputs.Major }}." + $VERSION_TAG += "${{ steps.gitversion.outputs.Minor }}." $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." - $VERSION_TAG += "${{ github.run_number }}" + $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}" echo $VERSION_TAG Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT - name: Package Copilot Chat WebAPI run: | - scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy -Version ${{ steps.versiontag.outputs.versiontag }} -InformationalVersion "Commit ${{ github.sha }}" + scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy -Version ${{ steps.versiontag.outputs.versiontag }} -InformationalVersion "Commit ${{ steps.gitversion.outputs.ShortSha }}" - name: Check formatting of Copilot Chat WebAPI run: | diff --git a/.github/workflows/copilot-deploy-environment.yml b/.github/workflows/copilot-deploy-environment.yml index 73eb59121..a8665718f 100644 --- a/.github/workflows/copilot-deploy-environment.yml +++ b/.github/workflows/copilot-deploy-environment.yml @@ -9,9 +9,6 @@ on: ARTIFACT_NAME: required: true type: string - VERSION: # Major and minor (ex: 1.0) part of a version string - required: true - type: string secrets: AZURE_CLIENT_ID: required: true @@ -60,7 +57,6 @@ jobs: with: DEPLOYMENT_NAME: ${{needs.deploy-infra.outputs.deployment-id}} ENVIRONMENT: ${{inputs.ENVIRONMENT}} - VERSION: ${{inputs.VERSION}} secrets: AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index 0e243a3bb..7ecf9eba9 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -9,9 +9,6 @@ on: DEPLOYMENT_NAME: required: true type: string - VERSION: # Major and minor (ex: 1.0) part of a version string - required: true - type: string secrets: AZURE_CLIENT_ID: required: true @@ -41,6 +38,7 @@ jobs: - uses: actions/checkout@v3 with: clean: true + fetch-depth: 0 - name: Install Azure CLI run: | @@ -72,15 +70,25 @@ jobs: echo "::add-mask::$swaToken" echo "SWA_CLI_DEPLOYMENT_TOKEN=$swaToken" >> $GITHUB_ENV + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: '5.x' + + - name: Determine version + id: gitversion + uses: gittools/actions/gitversion/execute@v0 + - name: Set version tag id: versiontag run: | - $VERSION_TAG = ${{ inputs.VERSION }} + $VERSION_TAG = "${{ steps.gitversion.outputs.Major }}." + $VERSION_TAG += "${{ steps.gitversion.outputs.Minor }}." $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." - $VERSION_TAG += "${{ github.run_number }}" + $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}" echo $VERSION_TAG Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT - name: Deploy SWA run: | - scripts/deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect -version ${{ steps.versiontag.outputs.versiontag }} -informational_version "Commit ${{ github.sha }}" + scripts/deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect -version ${{ steps.versiontag.outputs.versiontag }} -version-info "Commit ${{ steps.gitversion.outputs.ShortSha }}" diff --git a/.github/workflows/copilot-deploy-pipeline.yml b/.github/workflows/copilot-deploy-pipeline.yml index 4454cb79f..63a07437c 100644 --- a/.github/workflows/copilot-deploy-pipeline.yml +++ b/.github/workflows/copilot-deploy-pipeline.yml @@ -5,9 +5,6 @@ on: push: branches: ["main"] -env: - VERSION: '0.1' - concurrency: group: ${{ github.workflow }} cancel-in-progress: true @@ -19,8 +16,6 @@ permissions: jobs: build: uses: ./.github/workflows/copilot-build-backend.yml - with: - VERSION: ${{env.VERSION}} int: needs: build @@ -28,7 +23,6 @@ jobs: with: ENVIRONMENT: int ARTIFACT_NAME: ${{needs.build.outputs.artifact}} - VERSION: ${{env.VERSION}} secrets: AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} @@ -43,7 +37,6 @@ jobs: with: ENVIRONMENT: stable ARTIFACT_NAME: ${{needs.build.outputs.artifact}} - VERSION: ${{ $VERSION }} secrets: AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} diff --git a/scripts/deploy/deploy-webapp.ps1 b/scripts/deploy/deploy-webapp.ps1 index e1e1e802c..0be6c23d8 100644 --- a/scripts/deploy/deploy-webapp.ps1 +++ b/scripts/deploy/deploy-webapp.ps1 @@ -35,7 +35,7 @@ param( [string] # Additional information given in version info. (Ex: commit SHA) - $InformationalVersion = "" + $VersionInfo = "" ) Write-Host "Setting up Azure credentials..." @@ -73,7 +73,7 @@ Write-Host "Writing environment variables to '$envFilePath'..." "REACT_APP_AAD_CLIENT_ID=$ApplicationClientId" | Out-File -FilePath $envFilePath -Append "REACT_APP_SK_API_KEY=$webapiApiKey" | Out-File -FilePath $envFilePath -Append "REACT_APP_SK_VERSION=$Version" | Out-File -FilePath $envFilePath -Append -"REACT_APP_SK_BUILD_INFO=$InformationalVersion" | Out-File -FilePath $envFilePath -Append +"REACT_APP_SK_BUILD_INFO=$VersionInfo" | Out-File -FilePath $envFilePath -Append Write-Host "Generating SWA config..." $swaConfig = $(Get-Content "$PSScriptRoot/../../webapp/template.swa-cli.config.json" -Raw) diff --git a/scripts/deploy/deploy-webapp.sh b/scripts/deploy/deploy-webapp.sh index 2d428d661..3414d7b3f 100755 --- a/scripts/deploy/deploy-webapp.sh +++ b/scripts/deploy/deploy-webapp.sh @@ -16,7 +16,7 @@ usage() { echo " -a, --application-id APPLICATION_ID Client application ID (mandatory)" echo " -au, --authority Authority to use for client applications that are not configured as multi-tenant. Defaults to (https://login.microsoftonline.com/common) if not specified." echo " -v --version VERSION Version to display in UI (default: 1.0.0)" - echo " -i --info INFO Additional info to put in version details" + echo " -i --version-info INFO Additional info to put in version details" echo " -nr, --no-redirect Do not attempt to register redirect URIs with the client application" } @@ -54,8 +54,8 @@ while [[ $# -gt 0 ]]; do shift shift ;; - -i|--info) - INFO="$2" + -i|--version-nfo) + VERSION_INFO="$2" shift shift ;; @@ -110,7 +110,7 @@ echo "REACT_APP_AAD_AUTHORITY=$AUTHORITY" >> $ENV_FILE_PATH echo "REACT_APP_AAD_CLIENT_ID=$APPLICATION_ID" >> $ENV_FILE_PATH echo "REACT_APP_SK_API_KEY=$WEB_API_KEY" >> $ENV_FILE_PATH echo "REACT_APP_SK_VERSION=$VERSION" >> $ENV_FILE_PATH -echo "REACT_APP_SK_BUILD_INFO=$INFO" >> $ENV_FILE_PATH +echo "REACT_APP_SK_BUILD_INFO=$VERSION_INFO" >> $ENV_FILE_PATH echo "Writing swa-cli.config.json..." SWA_CONFIG_FILE_PATH="$SCRIPT_ROOT/../../webapp/swa-cli.config.json" From 9a210e9bb73aecf96765768bf324e002d4ec4fff Mon Sep 17 00:00:00 2001 From: Gil LaHaye Date: Tue, 15 Aug 2023 19:47:15 -0700 Subject: [PATCH 10/10] Changed formatting around --- .github/workflows/copilot-build-backend.yml | 5 ++--- .github/workflows/copilot-deploy-frontend.yml | 5 ++--- .../components/header/settings-dialog/SettingsDialog.tsx | 6 ++++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/copilot-build-backend.yml b/.github/workflows/copilot-build-backend.yml index a8582214d..aa463eb0c 100644 --- a/.github/workflows/copilot-build-backend.yml +++ b/.github/workflows/copilot-build-backend.yml @@ -50,14 +50,13 @@ jobs: run: | $VERSION_TAG = "${{ steps.gitversion.outputs.Major }}." $VERSION_TAG += "${{ steps.gitversion.outputs.Minor }}." - $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." - $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}" + $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" echo $VERSION_TAG Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT - name: Package Copilot Chat WebAPI run: | - scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy -Version ${{ steps.versiontag.outputs.versiontag }} -InformationalVersion "Commit ${{ steps.gitversion.outputs.ShortSha }}" + scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy -Version ${{ steps.versiontag.outputs.versiontag }} -InformationalVersion "Built from commit ${{ steps.gitversion.outputs.ShortSha }} on $(Get-Date -Format "yyyy-MM-dd")" - name: Check formatting of Copilot Chat WebAPI run: | diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index 7ecf9eba9..c32cdb5d4 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -84,11 +84,10 @@ jobs: run: | $VERSION_TAG = "${{ steps.gitversion.outputs.Major }}." $VERSION_TAG += "${{ steps.gitversion.outputs.Minor }}." - $VERSION_TAG += "$(Get-Date -Format "yyyyMMdd")." - $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}" + $VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" echo $VERSION_TAG Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT - name: Deploy SWA run: | - scripts/deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect -version ${{ steps.versiontag.outputs.versiontag }} -version-info "Commit ${{ steps.gitversion.outputs.ShortSha }}" + scripts/deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect -version ${{ steps.versiontag.outputs.versiontag }} -version-info "Built from commit ${{ steps.gitversion.outputs.ShortSha }} on $(Get-Date -Format "yyyy-MM-dd")" diff --git a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx index ee8bdce94..f7c614ad5 100644 --- a/webapp/src/components/header/settings-dialog/SettingsDialog.tsx +++ b/webapp/src/components/header/settings-dialog/SettingsDialog.tsx @@ -100,8 +100,10 @@ export const SettingsDialog: React.FC = ({ open, closeDial - Backend version: {serviceOptions.version}
- Frontend version: {process.env.REACT_APP_SK_VERSION ?? "-"}
+ Backend version: {serviceOptions.version} +
+ Frontend version: {process.env.REACT_APP_SK_VERSION ?? '-'} +
{process.env.REACT_APP_SK_BUILD_INFO}