File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,31 @@ jobs:
133133 fi
134134 ./.scripts/run_osx_build.sh
135135
136+ # https://github.com/aktech/cirun-azure-resize-disk
137+ - name : Resize all partitions to maximum
138+ if : matrix.os == 'windows'
139+ shell : pwsh
140+ run : |
141+ Write-Output "=== RESIZING PARTITIONS ==="
142+ $disks = Get-Disk | Where-Object PartitionStyle -ne 'RAW'
143+
144+ foreach ($disk in $disks) {
145+ $partitions = Get-Partition -DiskNumber $disk.Number
146+ foreach ($partition in $partitions) {
147+ try {
148+ $size = Get-PartitionSupportedSize -DiskNumber $disk.Number -PartitionNumber $partition.PartitionNumber
149+ if ($partition.Size -lt $size.SizeMax) {
150+ Write-Output "Resizing Disk $($disk.Number) Partition $($partition.PartitionNumber) from $($partition.Size) to $($size.SizeMax)"
151+ Resize-Partition -DiskNumber $disk.Number -PartitionNumber $partition.PartitionNumber -Size $size.SizeMax -Verbose
152+ } else {
153+ Write-Output "Disk $($disk.Number) Partition $($partition.PartitionNumber) already at max size ($($partition.Size))"
154+ }
155+ } catch {
156+ Write-Warning "Failed resizing Disk $($disk.Number) Partition $($partition.PartitionNumber): $_"
157+ }
158+ }
159+ }
160+
136161 - name : Build on windows
137162 id : build-windows
138163 if : matrix.os == 'windows'
You can’t perform that action at this time.
0 commit comments