Skip to content

Commit

Permalink
Fix destination folder definition in build process on Mac dev machines (
Browse files Browse the repository at this point in the history
#3907)

* fix destination folder definition

* fix destination folder definition

---------

Co-authored-by: Tobias Maestrini <tobias@bee365.ch>
  • Loading branch information
tmaestrini and Tobias Maestrini authored Apr 24, 2024
1 parent cb6874a commit ae9460a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
7 changes: 5 additions & 2 deletions build/Build-Debug.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,13 @@ if ($LASTEXITCODE -eq 0) {
# Load the Module in a new PowerShell session
$scriptBlock = {
$documentsFolder = [environment]::getfolderpath("mydocuments");

if ($IsLinux -or $isMacOS) {
if ($IsLinux) {
$destinationFolder = "$documentsFolder/.local/share/powershell/Modules/PnP.PowerShell"
}
elseif ($IsMacOS) {
$destinationFolder = "~/.local/share/powershell/Modules/PnP.PowerShell"
}
else {
$destinationFolder = "$documentsFolder/PowerShell/Modules/PnP.PowerShell"
}
Expand Down
33 changes: 16 additions & 17 deletions build/Build-Nightly.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@ $existing_pnppowershell_hash = Get-Content ./pnppowershell_hash.txt -Raw -ErrorA

$existing_pnpframework_hash = Get-Content ./pnpframework_hash.txt -Raw -ErrorAction SilentlyContinue
$pnpframework_response = Invoke-RestMethod -Method Get -Uri "$($env:GITHUB_API_URL)/repos/pnp/pnpframework/branches/dev" -SkipHttpErrorCheck
if($null -ne $pnpframework_response)
{
if($null -ne $pnpframework_response.commit)
{
if ($null -ne $pnpframework_response) {
if ($null -ne $pnpframework_response.commit) {
$pnpframework_hash = $pnpframework_response.commit.sha
}
}

$existing_pnpcoresdk_hash = Get-Content ./pnpcoresdk_hash.txt -Raw -ErrorAction SilentlyContinue
$pnpcoresdk_response = Invoke-RestMethod -Method Get -Uri "$($env:GITHUB_API_URL)/repos/pnp/pnpcore/branches/dev" -SkipHttpErrorCheck
if($null -ne $pnpcoresdk_response)
{
if($null -ne $pnpcoresdk_response.commit)
{
if ($null -ne $pnpcoresdk_response) {
if ($null -ne $pnpcoresdk_response.commit) {
$pnpcoresdk_hash = $pnpcoresdk_response.commit.sha
}
}
Expand All @@ -28,22 +24,19 @@ if($null -ne $pnpcoresdk_response)
#Write-host "Latest PnP Framework Commit hash $pnpframework_hash" -ForegroundColor Yellow
#Write-Host "Stored PnP Framework Commit hash: $existing_pnpframework_hash" -ForegroundColor Yellow

if ($existing_pnppowershell_hash -ne $pnppowershell_hash)
{
if ($existing_pnppowershell_hash -ne $pnppowershell_hash) {
Write-Host "PnP PowerShell is newer"
Set-Content ./pnppowershell_hash.txt -Value $pnppowershell_hash -NoNewline -Force
$runPublish = $true
}

if($runPublish -eq $false -and $existing_pnpframework_hash -ne $pnpframework_hash)
{
if ($runPublish -eq $false -and $existing_pnpframework_hash -ne $pnpframework_hash) {
Write-Host "PnP Framework is newer"
Set-Content ./pnpframework_hash.txt -Value $pnpframework_hash -NoNewline -Force
$runPublish = $true
}

if($runPublish -eq $false -and $existing_pnpcoresdk_hash -ne $pnpcoresdk_hash)
{
if ($runPublish -eq $false -and $existing_pnpcoresdk_hash -ne $pnpcoresdk_hash) {
Write-Host "PnP Core SDK is newer"
Set-Content ./pnpcoresdk_hash.txt -Value $pnpcoresdk_hash -NoNewLine -Force
$runPublish = $true
Expand Down Expand Up @@ -80,10 +73,13 @@ if ($runPublish -eq $true) {

$documentsFolder = [environment]::getfolderpath("mydocuments");

if ($IsLinux -or $isMacOS) {
if ($IsLinux) {
$destinationFolder = "$documentsFolder/.local/share/powershell/Modules/PnP.PowerShell"
}
else {
elseif ($IsMacOS) {
$destinationFolder = "~/.local/share/powershell/Modules/PnP.PowerShell"
}
else {
$destinationFolder = "$documentsFolder/PowerShell/Modules/PnP.PowerShell"
}

Expand Down Expand Up @@ -125,9 +121,12 @@ if ($runPublish -eq $true) {
$scriptBlock = {
$documentsFolder = [environment]::getfolderpath("mydocuments");

if ($IsLinux -or $isMacOS) {
if ($IsLinux) {
$destinationFolder = "$documentsFolder/.local/share/powershell/Modules/PnP.PowerShell"
}
elseif ($IsMacOS) {
$destinationFolder = "~/.local/share/powershell/Modules/PnP.PowerShell"
}
else {
$destinationFolder = "$documentsFolder/PowerShell/Modules/PnP.PowerShell"
}
Expand Down

0 comments on commit ae9460a

Please sign in to comment.