Skip to content

Commit

Permalink
Merge pull request #14 from DrDrrae/dev
Browse files Browse the repository at this point in the history
Create build.ps1
  • Loading branch information
DrDrrae authored Mar 23, 2024
2 parents 4c6deac + 834bf03 commit d43e81c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions build_scripts/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$Global:ErrorActionPreference = 'Stop'
$Global:VerbosePreference = 'SilentlyContinue'

$buildVersion = $env:BUILDVER
$manifestPath = "./ClickUpAPI/ClickUpAPI.psd1"
$publicFuncFolderPath = './ClickUpAPI/Public'


if (!(Get-PackageProvider | Where-Object { $_.Name -eq 'NuGet' })) {
Install-PackageProvider -Name NuGet -force | Out-Null
}
Import-PackageProvider -Name NuGet -force | Out-Null

if ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne 'Trusted') {
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
}

$manifestContent = (Get-Content -Path $manifestPath -Raw) -replace '<ModuleVersion>', $buildVersion

if ((Test-Path -Path $publicFuncFolderPath) -and ($publicFunctionNames = Get-ChildItem -Path $publicFuncFolderPath -Filter '*.ps1' | Select-Object -ExpandProperty BaseName)) {
$funcStrings = "'$($publicFunctionNames -join "','")'"
} else {
$funcStrings = $null
}

$manifestContent = $manifestContent -replace "'<FunctionsToExport>'", $funcStrings
$manifestContent | Set-Content -Path $manifestPath

0 comments on commit d43e81c

Please sign in to comment.