Skip to content

Commit

Permalink
👷 Updates Build Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
brucificus committed Aug 28, 2023
1 parent 1917870 commit 5163a1c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
20 changes: 12 additions & 8 deletions build/package-dev.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ if (Get-Command dotnet-gitversion -ErrorAction SilentlyContinue) {
elseif (Get-Command gitversion -ErrorAction SilentlyContinue) {
$gitversion_bin = Get-Command gitversion
}
else {
throw "Could not find gitversion commandline, please install it. See: https://gitversion.net/docs/usage/cli/installation."
}

[PSObject] $versionInfo = & $gitversion_bin | ConvertFrom-Json
if ($gitversion_bin) {
[PSObject] $versionInfo = & $gitversion_bin | ConvertFrom-Json

[string] $PackageVersionNuGet = $versionInfo | Select-Object -ExpandProperty NuGetVersionV2
[string] $PackageVersionPrereleaseTag = $versionInfo | Select-Object -ExpandProperty PreReleaseTag
[string] $PackageVersionMajorMinorPatchBuild = $versionInfo | Select-Object -ExpandProperty AssemblySemVer
[string] $PackageVersionNuGet = $versionInfo | Select-Object -ExpandProperty NuGetVersionV2
[string] $PackageVersionPrereleaseTag = $versionInfo | Select-Object -ExpandProperty PreReleaseTag
[string] $PackageVersionMajorMinorPatchBuild = $versionInfo | Select-Object -ExpandProperty AssemblySemVer
[string] $CommitSha = $versionInfo | Select-Object -ExpandProperty Sha
} else {
[string] $PackageVersionNuGet = "0.0.1"
[string] $PackageVersionPrereleaseTag = $null
[string] $PackageVersionMajorMinorPatchBuild = "0.0.1.0"
[string] $CommitSha = (git rev-parse HEAD)
}
[string] $ReleaseNotes = "Fake Release Notes"
[string] $CommitSha = $versionInfo | Select-Object -ExpandProperty Sha

if (-not $PackageVersionPrereleaseTag) {
$PackageVersionNuGet += "-dev"
Expand Down
15 changes: 10 additions & 5 deletions build/restore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ $ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest


if (-not (Get-Command nuget -ErrorAction SilentlyContinue)) {
throw "NuGet not found. Please install the NuGet CLI."
[string] $nuget_bin = $null
if (Get-Command nuget -ErrorAction SilentlyContinue) {
$nuget_bin = "nuget"
} elseif (Get-Command nuget.exe -ErrorAction SilentlyContinue) {
$nuget_bin = "nuget.exe"
} else {
throw "``nuget.exe` not found. Please install the NuGet CLI. See: https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools#nugetexe-cli."
}

[string] $ds = [System.IO.Path]::DirectorySeparatorChar
[string] $psgalleryNugetConfig = "$PSScriptRoot${ds}..${ds}NuGet.PSGallery.config"
[string] $psgalleryPackagesConfig = "$PSScriptRoot${ds}..${ds}packages.PSGallery.config"
[string] $psgalleryNugetConfig = "${PSScriptRoot}${ds}..${ds}NuGet.PSGallery.config"
[string] $psgalleryPackagesConfig = "${PSScriptRoot}${ds}..${ds}packages.PSGallery.config"

nuget restore $psgalleryPackagesConfig -ConfigFile $psgalleryNugetConfig
&$nuget_bin restore $psgalleryPackagesConfig -ConfigFile $psgalleryNugetConfig

0 comments on commit 5163a1c

Please sign in to comment.