Skip to content
Open
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
34 changes: 9 additions & 25 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ runs:
$vol = '${{ inputs.work-vol }}'
# If temporary drive D: doesn't exist in the VM, fallback to C:
if ("$vol" -eq '') {
if (Test-Path -LiteralPath 'D:\') {
$vol = 'D:'
} else {
$vol = 'C:'
}
$vol = (Test-Path -LiteralPath 'D:\') ? 'D:' : 'C:'
}

$setupExe = "$vol\setup.exe"
Expand Down Expand Up @@ -150,18 +146,10 @@ runs:
}
}

$installDir = "$vol\cygwin"
if ('${{ inputs.install-dir }}' -ne '') {
$installDir = '${{ inputs.install-dir }}'
}
$installDir = '${{ inputs.install-dir }}' -ne '' ? '${{ inputs.install-dir }}' : "$vol\cygwin"

$packageDir = "$vol\cygwin-packages"

$packages = '${{ inputs.packages }}'
$pkg_list = $packages.Split('', [System.StringSplitOptions]::RemoveEmptyEntries)
$pkg_list = $pkg_list | % { $_.Trim() }
$pkg_list = $pkg_list | % { $_.Trim(',') }

$args = @(
'-qnO',
'-l', "$packageDir",
Expand All @@ -180,13 +168,13 @@ runs:
} else {
$sites = 'http://mirrors.kernel.org/sourceware/cygwin/'
}
$site_list = $sites.Split('', [System.StringSplitOptions]::RemoveEmptyEntries)
$site_list = $site_list | % { $_.Trim() }
$site_list = $sites -split '[\s,]+',0,"RegexMatch,Singleline" | Where { $_ -ne '' }
foreach ($site in $site_list) {
$args += '-s'
$args += $site
}

$pkg_list = '${{ inputs.packages }}' -split '[\s,]+',0,"RegexMatch,Singleline" | Where { $_ -ne '' }
if ($pkg_list.Count -gt 0) {
$args += '-P'
$args += $pkg_list -Join(',')
Expand All @@ -196,14 +184,10 @@ runs:
$args += '-X'
}

if ( '${{ inputs.pubkeys }}' ) {
$pubkeys = '${{ inputs.pubkeys }}'
$pubkey_list = $pubkeys.Split('', [System.StringSplitOptions]::RemoveEmptyEntries)
$pubkey_list = $pubkey_list | % { $_.Trim() }
foreach ($pubkey in $pubkey_list) {
$args += '-K'
$args += $pubkey
}
$pubkey_list = '${{inputs.pubkeys}}' -split '[\s,]+',0,"RegexMatch,Singleline" | Where { $_ -ne '' }
foreach ($pubkey in $pubkey_list) {
$args += '-K'
$args += $pubkey
}

if ($platform -eq 'x86') {
Expand Down Expand Up @@ -232,7 +216,7 @@ runs:
echo "root=$installDir" >> $env:GITHUB_OUTPUT
echo "package-cache=$packageDir" >> $env:GITHUB_OUTPUT

shell: powershell
shell: pwsh

branding:
color: green
Expand Down
Loading