@ -17,291 +17,40 @@ jobs:
- name : Dependencies
- name : Dependencies
run : |
run : |
Write-Verbose -Message Dependencies -Verbose
. "SophiApp\Scripts\Dependencies.ps1"
# Download PolicyFileEditor
# https://github.com/dlwyatt/PolicyFileEditor
$Parameters = @{
Uri = "https://api.github.com/repos/dlwyatt/PolicyFileEditor/releases/latest"
UseBasicParsing = $true
}
$LatestPolicyFileEditorVersion = (Invoke-RestMethod @Parameters).tag_name
$Parameters = @{
Uri = "https://github.com/dlwyatt/PolicyFileEditor/archive/refs/tags/$LatestPolicyFileEditorVersion.zip"
OutFile = "Scripts\$LatestPolicyFileEditorVersion.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
# Expand zip archive
$Parameters = @{
Path = "Scripts\$LatestPolicyFileEditorVersion.zip"
DestinationPath = "Scripts"
Force = $true
Verbose = $true
}
Expand-Archive @Parameters
$Path = @(
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\DscResources" ,
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\en-US" ,
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\build.psake.ps1" ,
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\LICENSE" ,
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\PolicyFileEditor.Tests.ps1" ,
"Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion\README.md"
)
Remove-Item -Path $Path -Recurse -Force
Rename-Item -Path "Scripts\PolicyFileEditor-$LatestPolicyFileEditorVersion" -NewName "PolicyFileEditor" -Force
# Download Microsoft.Windows.SDK.NET.dll & WinRT.Runtime.dll
$Parameters = @{
Uri = "https://www.nuget.org/api/v2/package/Microsoft.Windows.SDK.NET.Ref"
OutFile = "Scripts\microsoft.windows.sdk.net.ref.zip"
UseBasicParsing = $true
}
Invoke-RestMethod @Parameters
# Extract Microsoft.Windows.SDK.NET.dll & WinRT.Runtime.dll from archive
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("Scripts\microsoft.windows.sdk.net.ref.zip")
$Entries = $ZIP.Entries | Where-Object -FilterScript {($_.FullName -eq "lib/net6.0/Microsoft.Windows.SDK.NET.dll") -or ($_.FullName -eq "lib/net6.0/WinRT.Runtime.dll")}
$Entries | ForEach-Object -Process {[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "Scripts\$($_.Name)", $true)}
$ZIP.Dispose()
- name : Sophia Script for Windows 10
- name : Sophia Script for Windows 10
run : |
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
. "SophiApp\Scripts\Windows_10.ps1"
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1
Write-Verbose -Message "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 10 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor")
Destination = "Sophia Script for Windows 10 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10" -Force | Copy-Item -Destination "Sophia Script for Windows 10 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 10 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name : Sophia Script for Windows 10 PowerShell 7
- name : Sophia Script for Windows 10 PowerShell 7
run : |
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
. "SophiApp\Scripts\Windows_10_PS_7.ps1"
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7
Write-Verbose -Message "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 10 PowerShell 7 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia Script for Windows 10 PowerShell 7 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10 PowerShell 7" -Force | Copy-Item -Destination "Sophia Script for Windows 10 PowerShell 7 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 10 PowerShell 7 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name : Sophia Script for Windows 10 LTSC 2019
- name : Sophia Script for Windows 10 LTSC 2019
run : |
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
. "SophiApp\Scripts\Windows_10_LTSC_2019.ps1"
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019
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
$Parameters = @{
Path = @("Scripts\PolicyFileEditor")
Destination = "Sophia Script for Windows 10 LTSC 2019 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10 LTSC 2019" -Force | Copy-Item -Destination "Sophia Script for Windows 10 LTSC 2019 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 10 LTSC 2019 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
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)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name : Sophia Script for Windows 10 LTSC 2021
- name : Sophia Script for Windows 10 LTSC 2021
run : |
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
. "SophiApp\Scripts\Windows_10_LTSC_2021.ps1"
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2021
Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 10 LTSC 2021 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor")
Destination = "Sophia Script for Windows 10 LTSC 2021 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10 LTSC 2021" -Force | Copy-Item -Destination "Sophia Script for Windows 10 LTSC 2021 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 10 LTSC 2021 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name : Sophia Script for Windows 11
- name : Sophia Script for Windows 11
run : |
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
. "SophiApp\Scripts\Windows_10.ps1"
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
Write-Verbose -Message "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 11 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor")
Destination = "Sophia Script for Windows 11 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 11" -Force | Copy-Item -Destination "Sophia Script for Windows 11 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 11 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name : Sophia Script for Windows 11 PowerShell 7
- name : Sophia Script for Windows 11 PowerShell 7
run : |
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
. "SophiApp\Scripts\Windows_10_PS_7.ps1"
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7
Write-Verbose -Message "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 11 PowerShell 7 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("Scripts\PolicyFileEditor", "Scripts\WinRT.Runtime.dll", "Scripts\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia Script for Windows 11 PowerShell 7 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 11 PowerShell 7" -Force | Copy-Item -Destination "Sophia Script for Windows 11 PowerShell 7 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 11 PowerShell 7 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name : Sophia Script Wrapper
- name : Sophia Script Wrapper
run : |
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
. "SophiApp\Scripts\Wrapper.ps1"
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Wrapper
Write-Verbose -Message "Sophia.Script.Wrapper.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script Wrapper v$LatestRelease" -ItemType Directory -Force
Get-ChildItem -Path Wrapper -Exclude README.md -Force | Copy-Item -Destination "Sophia Script Wrapper v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script Wrapper v$LatestRelease"
DestinationPath = "Sophia.Script.Wrapper.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.Wrapper.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name : ReleaseNotesTemplate
- name : ReleaseNotesTemplate
id : read_release
id : read_release
run : |
run : |
# Get a penultimate build tag
$Parameters = @{
$Parameters = @{
Uri = "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases"
Uri = "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases"
UseBasicParsing = $true
UseBasicParsing = $true
@ -314,6 +63,7 @@ jobs:
# https://trstringer.com/github-actions-multiline-strings/
# https://trstringer.com/github-actions-multiline-strings/
echo "::set-output name=RELEASE_BODY::$Release"
echo "::set-output name=RELEASE_BODY::$Release"
$ReleaseName = Get-Date -f "dd.MM.yyyy"
$ReleaseName = Get-Date -f "dd.MM.yyyy"
echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV
echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV