GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — migrate the mac offical binary build to VSTS mac hosted preview (#6363) · PowerShell/PowerShell@5e1bb01

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tools/releaseBuild/macOS
    • PowerShellPackageVsts.ps1
    • PowerShellPackageVsts.sh
    • createPowerShell.sh
    • vsts.yml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tools/releaseBuild/macOS/PowerShellPackageVsts.ps1‎

Copy file name to clipboard
+96Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
# PowerShell Script to build and package PowerShell from specified form and branch
5+
# Script is intented to use in Docker containers
6+
# Ensure PowerShell is available in the provided image
7+
8+
param (
9+
# Set default location to where VSTS cloned the repository locally.
10+
[string] $location = $env:BUILD_REPOSITORY_LOCALPATH,
11+
12+
# Destination location of the package on docker host
13+
[Parameter(Mandatory, ParameterSetName = 'Build')]
14+
[string] $destination = '/mnt',
15+
16+
[Parameter(Mandatory, ParameterSetName = 'Build')]
17+
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+(\.\d+)?)?$")]
18+
[ValidateNotNullOrEmpty()]
19+
[string]$ReleaseTag,
20+
21+
[Parameter(ParameterSetName = 'Build')]
22+
[ValidateSet("zip", "tar")]
23+
[string[]]$ExtraPackage,
24+
25+
[Parameter(Mandatory, ParameterSetName = 'Bootstrap')]
26+
[switch] $BootStrap,
27+
28+
[Parameter(Mandatory, ParameterSetName = 'Build')]
29+
[switch] $Build
30+
)
31+
32+
# We must build in /PowerShell
33+
$repoRoot = '/PowerShell'
34+
if ($BootStrap.IsPresent) {
35+
$repoRoot = $location
36+
}
37+
38+
if ($Build.IsPresent) {
39+
# cleanup the folder but don't delete it or the build agent will loose ownership of the folder
40+
Write-Verbose -Message "cleaning /PowerShell" -Verbose
41+
Get-ChildItem -Path /PowerShell/* -Attributes Hidden, Normal, Directory | Remove-Item -Recurse -Force
42+
43+
# clone the repository to the location we must build from
44+
Write-Verbose -Message "cloning to /PowerShell" -Verbose
45+
git clone $location /PowerShell
46+
$releaseTagParam = @{}
47+
if ($ReleaseTag) {
48+
$releaseTagParam = @{ 'ReleaseTag' = $ReleaseTag }
49+
}
50+
}
51+
52+
53+
Push-Location
54+
try {
55+
Write-Verbose -Message "Init..." -Verbose
56+
Set-Location $repoRoot
57+
git submodule update --init --recursive --quiet
58+
Import-Module "$repoRoot/build.psm1"
59+
Import-Module "$repoRoot/tools/packaging"
60+
Sync-PSTags -AddRemoteIfMissing
61+
62+
if ($BootStrap.IsPresent) {
63+
Start-PSBootstrap -Package
64+
65+
# The gem install is run by bootstrap without sudo and fails on macOS.
66+
# Run the commands with sudo, to resolve the issue
67+
Write-Verbose -Message "Installing fpm..." -Verbose
68+
Start-NativeExecution { sudo gem install fpm -v 1.8.1 }
69+
Write-Verbose -Message "Installing ronn..." -Verbose
70+
Start-NativeExecution { sudo gem install ronn }
71+
}
72+
73+
if ($Build.IsPresent) {
74+
Start-PSBuild -Crossgen -PSModuleRestore @releaseTagParam
75+
76+
Start-PSPackage @releaseTagParam
77+
switch ($ExtraPackage) {
78+
"tar" { Start-PSPackage -Type tar @releaseTagParam }
79+
}
80+
}
81+
} finally {
82+
Pop-Location
83+
}
84+
85+
if ($Build.IsPresent) {
86+
$macPackages = Get-ChildItem "$repoRoot/powershell*" -Include *.pkg, *.tar.gz
87+
foreach ($macPackage in $macPackages) {
88+
$filePath = $macPackage.FullName
89+
$name = split-path -Leaf -Path $filePath
90+
$extension = (Split-Path -Extension -Path $filePath).Replace('.', '')
91+
Write-Verbose "Copying $filePath to $destination" -Verbose
92+
Write-Host "##vso[artifact.upload containerfolder=results;artifactname=$name]$filePath"
93+
Write-Host "##vso[task.setvariable variable=Package-$extension]$filePath"
94+
Copy-Item -Path $filePath -Destination $destination -force
95+
}
96+
}
Collapse file

‎tools/releaseBuild/macOS/PowerShellPackageVsts.sh‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pwsh -command ".\PowerShellPackageVsts.ps1 $*"
Collapse file

‎tools/releaseBuild/macOS/createPowerShell.sh‎

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# print version for diags
2+
sw_vers -productVersion
3+
4+
# create folder
5+
sudo mkdir /PowerShell
6+
7+
# make the current user the owner
8+
sudo chown $USER /PowerShell
Collapse file

‎tools/releaseBuild/macOS/vsts.yml‎

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
steps:
2+
#- task: <task type name>@<version>
3+
# inputs:
4+
# <task specific inputs>
5+
# displayName: '<display name of task>'
6+
- task: ShellScript@2
7+
inputs:
8+
scriptPath: 'tools/releaseBuild/setReleaseTag.sh'
9+
args: '-ReleaseTag $(ReleaseTagVar) -Variable "ReleaseTagVar"'
10+
displayName: 'Calculate Release Tag'
11+
- task: ShellScript@2
12+
inputs:
13+
scriptPath: 'tools/installpsh-osx.sh'
14+
displayName: 'Install pwsh'
15+
- task: ShellScript@2
16+
inputs:
17+
scriptPath: 'tools/releaseBuild/macOS/createPowerShell.sh'
18+
displayName: 'Create /PowerShell'
19+
- task: ShellScript@2
20+
inputs:
21+
scriptPath: 'tools/releaseBuild/macOS/PowerShellPackageVsts.sh'
22+
args: '-location $(Build.SourcesDirectory) -BootStrap'
23+
displayName: 'Bootstrap VM'
24+
- task: ShellScript@2
25+
inputs:
26+
scriptPath: 'tools/releaseBuild/macOS/PowerShellPackageVsts.sh'
27+
args: '-ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -ExtraPackage "tar" -location $(Build.SourcesDirectory) -Build'
28+
disableAutoCwd: true
29+
cwd: 'tools/releaseBuild/macOS'
30+
displayName: 'Build and Package'

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.