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

Fix destination folder definition in build process on Mac dev machines #3907

Merged
merged 2 commits into from
Apr 24, 2024
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
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