Skip to content

Commit

Permalink
build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
guirava committed Mar 13, 2024
1 parent 7026a3e commit b639b53
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 11 deletions.
39 changes: 28 additions & 11 deletions Utils/Build-RscSdk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,41 @@ if ($Release) {
# Stop on error
$ErrorActionPreference = "Stop"

# Make sure we have dotnet
try {
$dotnetVersion = dotnet --version
Write-Host "dotnet version: $dotnetVersion"
} catch {
Write-Error "Failed to execute 'dotnet --version'. Please ensure .NET SDK is correctly installed and accessible."
exit 1
}

# Build the project
if ($Release) {
dotnet build --configuration Release /p:GeneratePSDocs=true $ProjectDir
$buildCommand = if ($Release) {
"dotnet build --configuration Release /p:GeneratePSDocs=true $ProjectDir"
} elseif ($NoDocs) {
"dotnet build $ProjectDir"
} else {
"dotnet build /p:GeneratePSDocs=true $ProjectDir"
}
else {
if ($NoDocs) {
dotnet build $ProjectDir
}
else {
dotnet build /p:GeneratePSDocs=true $ProjectDir
}

Invoke-Expression $buildCommand

if ($LASTEXITCODE -ne 0 ) {
Write-Error "dotnet build failed."
exit $LASTEXITCODE
}

# Copy the output to the output directory
Copy-Item -Recurse -Force $ProjectOutputDir $OutputDir
Copy-Item $OutputDir\net6.0\RubrikSecurityCloud.PowerShell.dll-Help.xml $OutputDir\net472\RubrikSecurityCloud.PowerShell.dll-Help.xml
$helpXmlPath = "$OutputDir\net6.0\RubrikSecurityCloud.PowerShell.dll-Help.xml"
if (Test-Path $helpXmlPath) {
Copy-Item $helpXmlPath $OutputDir\net472\
} else {
Write-Warning "Documentation XML file not found. Skipping copy."
}

if (-not $NoTests) {
# Run the tests
.\Utils\Test-RscSdk.ps1
}
}
16 changes: 16 additions & 0 deletions Utils/New-RscSdkChangelogEntry.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<#
.SYNOPSIS
Update CHANGELOG.md with a new empty version entry
#>
param(
[switch]$Commit = $false
)
$changelogPath = Join-Path -Path $PSScriptRoot\.. -ChildPath "CHANGELOG.md"
$changelogContent = Get-Content -Path $changelogPath -Raw
$changelogContent = $changelogContent -replace "`r`n", "`n"
$changelogContent = $changelogContent -replace "(?<=# Changelog`n)", "`n## ~ Upcoming Version ~`n`nNew Features:`n`nFixes:`n`nBreaking Changes:`n"
Set-Content -Path $changelogPath -Value $changelogContent
if ($Commit) {
git add $changelogPath
git commit -m "Prepare for next development iteration"
}
8 changes: 8 additions & 0 deletions Utils/Update-RscSdkMainBranch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ RunIfNotDry {
gh release create $versionTag -t $versionTag -n "$versionEntry"
}

# Prepare devel branch for further development
RunIfNotDry {
git checkout devel
Set-Location $PSScriptRoot\..
.\Utils\New-RscSdkChangeLogEntry.ps1 -Commit
git push origin devel
}

Write-Host "Done." -ForegroundColor Green
Write-Host "git status:"
git status

0 comments on commit b639b53

Please sign in to comment.