1+ # Uncomment these for local testing
2+ # $Env:GITHUB_WORKSPACE = "C:\Working Directories\PD\essentials"
3+ # $Env:SOLUTION_FILE = "PepperDashEssentials"
4+ # $Env:VERSION = "0.0.0-buildType-test"
5+
6+ # Sets the root directory for the operation
7+ $destination = " $ ( $Env: GITHUB_HOME ) \output"
8+ New-Item - ItemType Directory - Force - Path ($destination )
9+ Get-ChildItem ($destination )
10+ $exclusions = @ (git submodule foreach -- quiet ' echo $name' )
11+ # Trying to get any .json schema files (not currently working)
12+ # Gets any files with the listed extensions.
13+ Get-ChildItem - recurse - Path " $ ( $Env: GITHUB_WORKSPACE ) " - include " *.cplz" | ForEach-Object {
14+ $allowed = $true ;
15+ # Exclude any files in submodules
16+ foreach ($exclude in $exclusions ) {
17+ if ((Split-Path $_.FullName - Parent).contains(" $ ( $exclude ) " )) {
18+ $allowed = $false ;
19+ break ;
20+ }
21+ }
22+ if ($allowed ) {
23+ Write-Host " allowing $ ( $_ ) "
24+ $_ ;
25+ }
26+ } | Copy-Item - Destination ($destination ) - Force
27+ Write-Host " Getting matching files..."
28+ # Get any files from the output folder that match the following extensions
29+ Get-ChildItem - Path $destination | Where-Object {($_.Extension -eq " .clz" ) -or ($_.Extension -eq " .cpz" -or ($_.Extension -eq " .cplz" ))} | ForEach-Object {
30+ # Replace the extensions with dll and xml and create an array
31+ $filenames = @ ($ ($_ -replace " cpz|clz|cplz" , " dll" ), $ ($_ -replace " cpz|clz|cplz" , " xml" ))
32+ Write-Host " Filenames:"
33+ Write-Host $filenames
34+ if ($filenames.length -gt 0 ) {
35+ # Attempt to get the files and return them to the output directory
36+ Get-ChildItem - Recurse - Path " $ ( $Env: GITHUB_WORKSPACE ) " - include $filenames | Copy-Item - Destination ($destination ) - Force
37+ }
38+ }
39+ Get-ChildItem - Path $destination \* .cplz | Rename-Item - NewName { " $ ( $_.BaseName ) -$ ( $Env: VERSION ) $ ( $_.Extension ) " }
40+ Compress-Archive - Path $destination - DestinationPath " $ ( $Env: GITHUB_WORKSPACE ) \$ ( $Env: SOLUTION_FILE ) -$ ( $Env: VERSION ) .zip" - Force
41+ Write-Host " Output Contents post Zip"
42+ Get-ChildItem - Path $destination
0 commit comments