Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Power BI optional in Package-Toolkit.ps1 #456

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 38 additions & 7 deletions src/scripts/Package-Toolkit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
.PARAMETER Build
Optional. Indicates whether the Build-Toolkit command should be executed first. Default = false.

.PARAMETER PowerBI
Optional. Indicates whether to open Power BI files as part of the packaging process. Default = false.

.EXAMPLE
./Package-Toolkit

Expand All @@ -26,7 +29,8 @@
#>
Param(
[Parameter(Position = 0)][string]$Template = "*",
[switch]$Build
[switch]$Build,
[switch]$PowerBI
)

# Use the debug flag from common parameters to determine whether to run in debug mode
Expand All @@ -48,10 +52,11 @@ if ($Template -ne "*" -and -not (Test-Path $relDir))
return
}

Write-Host "Packaging templates..."
Write-Host "Packaging v$version templates..."

# Package templates
$version = & "$PSScriptRoot/Get-Version"
$isPrerelease = $version -like '*-*'

Write-Verbose "Removing existing ZIP files..."
Remove-Item "$relDir/*-v$version.zip" -Force
Expand Down Expand Up @@ -95,13 +100,39 @@ Write-Host "βœ… $((Get-ChildItem "$relDir/*.csv").Count) open data files"

# Open Power BI reports
$pbi = Get-ChildItem "$PSScriptRoot/../power-bi/*.pbip"
Write-Host "⚠️ $($pbi.Count) Power BI reports must be converted manually... Opening..."
$pbi | Invoke-Item
if ($PowerBI)
{
Write-Host "ℹ️ $($pbi.Count) Power BI reports must be converted manually... Opening..."
$pbi | Invoke-Item
}
elseif ($isPrerelease)
{
Write-Host "βœ–οΈ Skipping $($pbi.Count) Power BI reports for prerelease version"
}
else
{
Write-Host "⚠️ $($pbi.Count) Power BI reports must be converted manually!"
Write-Host ' To open them, run: ' -NoNewline
Write-Host './Package-Toolkit -PowerBI' -ForegroundColor Cyan
}

# Update version in docs
Write-Verbose "Updating version in docs..."
$version | Out-File "$PSScriptRoot/../../docs/_includes/version.txt" -NoNewline
Write-Host "ℹ️ Version updated in docs. Please commit the changes manually."
$docVersionPath = "$PSScriptRoot/../../docs/_includes/version.txt"
$versionInDocs = Get-Content $docVersionPath -Raw
if ($isPrerelease)
{
Write-Host "βœ–οΈ Skipping version in docs ($versionInDocs) for prerelease version"
}
elseif ($versionInDocs -eq $version)
{
Write-Host "βœ… Version in docs ($versionInDocs) already up-to-date"
}
else
{
Write-Verbose "Updating version in docs..."
$version | Out-File $docVersionPath -NoNewline
Write-Host "ℹ️ Version updated in docs... Please commit the changes manually..."
}

Write-Host '...done!'
Write-Host ''
9 changes: 5 additions & 4 deletions src/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ Example:

[Package-Toolkit.ps1](./Package-Toolkit.ps1) packages all toolkit templates as ZIP files for release.

| Parameter | Description |
| ----------- | ------------------------------------------------------------------------------------------------ |
| `‑Template` | Optional. Name of the template or module to package. Default = \* (all). |
| `‑Build` | Optional. Indicates whether the Build-Toolkit command should be executed first. Default = false. |
| Parameter | Description |
| ----------- | ----------------------------------------------------------------------------------------------------- |
| `‑Template` | Optional. Name of the template or module to package. Default = \* (all). |
| `‑Build` | Optional. Indicates whether the Build-Toolkit command should be executed first. Default = false. |
| `‑PowerBI` | Optional. Indicates whether to open Power BI files as part of the packaging process. Default = false. |

Examples:

Expand Down