Browse Source

Update CI/CD scripts

pull/401/head
Dmitry Nefedov 2 years ago
parent
commit
64c4b488eb
  1. 36
      Scripts/Dependencies.ps1
  2. 2
      Scripts/Windows_10.ps1
  3. 8
      Scripts/Windows_10_LTSC_2019.ps1
  4. 2
      Scripts/Windows_10_LTSC_2021.ps1
  5. 2
      Scripts/Windows_10_PS_7.ps1
  6. 2
      Scripts/Windows_11.ps1
  7. 2
      Scripts/Windows_11_PS_7.ps1

36
Scripts/Dependencies.ps1

@ -1,37 +1,33 @@
Write-Verbose -Message Dependencies -Verbose Write-Verbose -Message Dependencies -Verbose
# Download PolicyFileEditor # Download LGPO
# https://github.com/dlwyatt/PolicyFileEditor # https://techcommunity.microsoft.com/t5/microsoft-security-baselines/lgpo-exe-local-group-policy-object-utility-v1-0/ba-p/701045
$Parameters = @{ $Parameters = @{
Uri = "https://api.github.com/repos/dlwyatt/PolicyFileEditor/releases/latest" Uri = "https://download.microsoft.com/download/8/5/C/85C25433-A1B0-4FFA-9429-7E023E7DA8D8/LGPO.zip"
UseBasicParsing = $true OutFile = "Scripts\LGPO.zip"
}
$LatestPolicyFileEditorVersion = (Invoke-RestMethod @Parameters).tag_name
$Parameters = @{
Uri = "https://github.com/dlwyatt/PolicyFileEditor/archive/refs/tags/$LatestPolicyFileEditorVersion.zip"
OutFile = "Scripts\$LatestPolicyFileEditorVersion.zip"
UseBasicParsing = $true UseBasicParsing = $true
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters Invoke-WebRequest @Parameters
# Expand zip archive # Expand zip archive
$Parameters = @{ $Parameters = @{
Path = "Scripts\$LatestPolicyFileEditorVersion.zip" Path = "Scripts\LGPO.zip"
DestinationPath = "Scripts" DestinationPath = "Scripts"
Force = $true Force = $true
Verbose = $true Verbose = $true
} }
Expand-Archive @Parameters Expand-Archive @Parameters
$Path = @(
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\DscResources", $Parameters = @{
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\en-US", Path = "Scripts\LGPO_30\LGPO.exe"
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\build.psake.ps1", Destination = Scripts
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\LICENSE", Force = $true
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\PolicyFileEditor.Tests.ps1", }
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\README.md" Move-Item @Parameters
)
Remove-Item -Path $Path -Recurse -Force Remove-Item -Path "Scripts\LGPO_30", "Scripts\LGPO.zip" -Recurse -Force
Rename-Item -Path "Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion" -NewName "PolicyFileEditor" -Force
# Download Microsoft.Windows.SDK.NET.dll & WinRT.Runtime.dll # Download Microsoft.Windows.SDK.NET.dll & WinRT.Runtime.dll
$Parameters = @{ $Parameters = @{
Uri = "https://www.nuget.org/api/v2/package/Microsoft.Windows.SDK.NET.Ref" Uri = "https://www.nuget.org/api/v2/package/Microsoft.Windows.SDK.NET.Ref"

2
Scripts/Windows_10.ps1

@ -9,7 +9,7 @@ Write-Verbose -Message "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Verbo
New-Item -Path "Sophia_Script_for_Windows_10_v$LatestRelease\bin" -ItemType Directory -Force New-Item -Path "Sophia_Script_for_Windows_10_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{ $Parameters = @{
Path = @("Scripts\PolicyFileEditor") Path = @("Scripts\LGPO.exe")
Destination = "Sophia_Script_for_Windows_10_v$LatestRelease\bin" Destination = "Sophia_Script_for_Windows_10_v$LatestRelease\bin"
Recurse = $true Recurse = $true
Force = $true Force = $true

8
Scripts/Windows_10_LTSC_2019.ps1

@ -3,16 +3,21 @@ $Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
} }
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019 $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019
Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" -Verbose Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease\bin" -ItemType Directory -Force New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{ $Parameters = @{
Path = @("Scripts\PolicyFileEditor") Path = @("Scripts\LGPO.exe")
Destination = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease\bin" Destination = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease\bin"
Recurse = $true Recurse = $true
Force = $true Force = $true
} }
Copy-Item @Parameters Copy-Item @Parameters
Get-ChildItem -Path "src\Sophia_Script_for_Windows_10_LTSC_2019" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease" -Recurse -Force Get-ChildItem -Path "src\Sophia_Script_for_Windows_10_LTSC_2019" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease" -Recurse -Force
$Parameters = @{ $Parameters = @{
Path = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease" Path = "Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip"
@ -20,6 +25,7 @@ $Parameters = @{
Force = $true Force = $true
} }
Compress-Archive @Parameters Compress-Archive @Parameters
# Calculate hash # Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" -Force | ForEach-Object -Process { Get-Item -Path "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)" "$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"

2
Scripts/Windows_10_LTSC_2021.ps1

@ -9,7 +9,7 @@ Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.z
New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease\bin" -ItemType Directory -Force New-Item -Path "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{ $Parameters = @{
Path = @("Scripts\PolicyFileEditor") Path = @("Scripts\LGPO.exe")
Destination = "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease\bin" Destination = "Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease\bin"
Recurse = $true Recurse = $true
Force = $true Force = $true

2
Scripts/Windows_10_PS_7.ps1

@ -9,7 +9,7 @@ Write-Verbose -Message "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestReleas
New-Item -Path "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease\bin" -ItemType Directory -Force New-Item -Path "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{ $Parameters = @{
Path = @("Scripts\PolicyFileEditor", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll") Path = @("Scripts\LGPO.exe", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease\bin" Destination = "Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease\bin"
Recurse = $true Recurse = $true
Force = $true Force = $true

2
Scripts/Windows_11.ps1

@ -9,7 +9,7 @@ Write-Verbose -Message "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Verbo
New-Item -Path "Sophia_Script_for_Windows_11_v$LatestRelease\bin" -ItemType Directory -Force New-Item -Path "Sophia_Script_for_Windows_11_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{ $Parameters = @{
Path = @("Scripts\PolicyFileEditor") Path = @("Scripts\LGPO.exe")
Destination = "Sophia_Script_for_Windows_11_v$LatestRelease\bin" Destination = "Sophia_Script_for_Windows_11_v$LatestRelease\bin"
Recurse = $true Recurse = $true
Force = $true Force = $true

2
Scripts/Windows_11_PS_7.ps1

@ -9,7 +9,7 @@ Write-Verbose -Message "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestReleas
New-Item -Path "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease\bin" -ItemType Directory -Force New-Item -Path "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{ $Parameters = @{
Path = @("Scripts\PolicyFileEditor", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll") Path = @("Scripts\LGPO.exe", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease\bin" Destination = "Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease\bin"
Recurse = $true Recurse = $true
Force = $true Force = $true

Loading…
Cancel
Save