Skip to content

Commit

Permalink
Finish upgrade to latest hotfix.
Browse files Browse the repository at this point in the history
  • Loading branch information
BS-jiriceska committed Oct 25, 2024
1 parent 374e28e commit c6d8229
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 62 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ jobs:
with:
global-json-file: global.json

- name: Install dependencies
run: |
dotnet restore
- name: Get Database Backup Name
run: |
$latestBackups = Get-Content -Path "./database/backups.txt" -TotalCount 2
Expand Down Expand Up @@ -120,12 +116,7 @@ jobs:
run: |
dotnet build `
--configuration Release `
--no-restore
- name: Restore CI Repository
working-directory: "./scripts"
run: |
./Restore-CI.ps1
-t:Rebuild
- name: Publish Application
run: |
Expand Down
7 changes: 3 additions & 4 deletions examples/DancingGoat-K13Ecommerce/DancingGoat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@
<ProjectReference Include="..\..\src\Kentico.Xperience.Store.Rcl\Kentico.Xperience.Store.Rcl.csproj" />
</ItemGroup>
<Target Name="DisableCI" BeforeTargets="Rebuild">
<Exec Command="powershell -ExecutionPolicy Bypass -File ..\..\scripts\ToggleCI_CI.ps1" Condition="'$(ASPNETCORE_ENVIRONMENT)' == 'CI'" />
<Exec Command="powershell -ExecutionPolicy Bypass -File ..\..\scripts\ToggleCI_DEV.ps1" Condition="'$(ASPNETCORE_ENVIRONMENT)' != 'CI'" />
<Exec Command="powershell -ExecutionPolicy Bypass -File ..\..\scripts\Toggle-CI.ps1" />
</Target>
<Target Name="UpgradeXbK" AfterTargets="Rebuild">
<Exec Command="dotnet run --no-build -- --kxp-update --skip-confirmation" />
<Exec Command="powershell -ExecutionPolicy Bypass -File ..\..\scripts\ToggleCI_CI.ps1 -CIEnabled" Condition="'$(ASPNETCORE_ENVIRONMENT)' == 'CI'" />
<Exec Command="powershell -ExecutionPolicy Bypass -File ..\..\scripts\ToggleCI_DEV.ps1 -CIEnabled" Condition="'$(ASPNETCORE_ENVIRONMENT)' != 'CI'" />
<Exec Command="powershell -ExecutionPolicy Bypass -File ..\..\scripts\Toggle-CI.ps1 -CIEnabled" />
<Exec Command="powershell -ExecutionPolicy Bypass -File ..\..\scripts\Restore-CI.ps1" />
<Exec Command="dotnet run --no-build -- --kxp-codegen --type ReusableContentTypes --namespace K13Store --location ../../src/Kentico.Xperience.K13Ecommerce/{type}/{dataClassNamespace}/{name}/ --skip-confirmation --include K13Store.*" />
</Target>
</Project>
39 changes: 16 additions & 23 deletions scripts/Restore-CI.ps1
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
Import-Module (Resolve-Path Utilities) `
-Function `
Get-WebProjectPath, `
Invoke-ExpressionWithException, `
Write-Status `
-Force
if ($Env:ASPNETCORE_ENVIRONMENT -eq "CI") {
$launchProfile = "K13Ecommerce.WebCI"
$configuration = "Release"
} else {
$launchProfile = "DancingGoat"
$configuration = "Debug"
}

$projectPath = Get-WebProjectPath
$repositoryPath = Join-Path $projectPath "App_Data/CIRepository"
$launchProfile = $Env:ASPNETCORE_ENVIRONMENT -eq "CI" ? "K13Ecommerce.WebCI" : "DancingGoat"
$configuration = $Env:ASPNETCORE_ENVIRONMENT -eq "CI" ? "Release" : "Debug"
dotnet run `
--launch-profile $launchProfile `
-c $configuration `
--no-build `
--no-restore `
--kxp-ci-restore

$command = "dotnet run " + `
"--launch-profile $launchProfile " + `
"-c $configuration " + `
"--no-build " + `
"--no-restore " + `
"--project $projectPath " + `
"--kxp-ci-restore"

Invoke-ExpressionWithException $command

Write-Host "`n"
Write-Status 'CI files processed'
Write-Host "`n"
Write-Host ""
Write-Host 'CI files processed'
Write-Host ""
25 changes: 25 additions & 0 deletions scripts/Toggle-CI.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
param (
[switch]$CIEnabled
)

# Use a conditional expression to set KeyValue based on the boolean $Argument
$keyValue = if ($CIEnabled) { 'True' } else { 'False' }


# Check the environment variable
if ($Env:ASPNETCORE_ENVIRONMENT -eq "CI") {
sqlcmd `
-S localhost `
-d XByK_DancingGoat_K13Ecommerce `
-U "sa" `
-P "Pass@12345" `
-Q "UPDATE CMS_SettingsKey SET KeyValue='$keyValue' WHERE KeyName='CMSEnableCI'"
} else {
sqlcmd `
-S localhost\SQLEXPRESS `
-d XByK_DancingGoat_K13Ecommerce `
-E `
-Q "UPDATE CMS_SettingsKey SET KeyValue='$keyValue' WHERE KeyName='CMSEnableCI'"
}

Write-Output "CI restore for Enabled=$keyValue"
13 changes: 0 additions & 13 deletions scripts/ToggleCI_CI.ps1

This file was deleted.

12 changes: 0 additions & 12 deletions scripts/ToggleCI_DEV.ps1

This file was deleted.

0 comments on commit c6d8229

Please sign in to comment.