name : Build
on :
push :
tags :
- '*.*.*'
- '*.*'
jobs :
patch :
runs-on : windows-latest
timeout-minutes : 5
steps :
- uses : actions/checkout@master
- name : Sophia Script for Windows 10
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/irm/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1
New-Item -Path "Sophia Script for Windows 10 v$LatestRelease" -ItemType Directory -Force
Write-Verbose -Message "Sophia Script for Windows 10 v$LatestRelease" -Verbose
Write-Verbose -Message "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Verbose
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
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/irm/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7
New-Item -Path "Sophia Script for Windows 10 v$LatestRelease PowerShell 7" -ItemType Directory -Force
Write-Verbose -Message "Sophia Script for Windows 10 v$LatestRelease PowerShell 7" -Verbose
Write-Verbose -Message "Sophia.Script.for.Windows.10.v$LatestRelease.PowerShell.7.zip" -Verbose
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10 PowerShell 7" -Force | Copy-Item -Destination "Sophia Script for Windows 10 v$LatestRelease PowerShell 7" -Recurse -Force
# Download Microsoft.Windows.SDK.NET.Ref
$Parameters = @{
Uri = "https://www.nuget.org/api/v2/package/Microsoft.Windows.SDK.NET.Ref"
OutFile = "$PSScriptRoot\microsoft.windows.sdk.net.ref.nupkg"
Verbose = $true
}
Invoke-WebRequest @Parameters
Rename-Item -Path "$PSScriptRoot\Microsoft.Windows.SDK.NET.Ref.nupkg" -NewName "Microsoft.Windows.SDK.NET.Ref.zip"
$Parameters = @{
Path = "$PSScriptRoot\Microsoft.Windows.SDK.NET.Ref.zip"
DestinationPath = "$PSScriptRoot\SDK"
Force = $true
Verbose = $true
}
Expand-Archive @Parameters
# Download CsWinRT
$Parameters = @{
Uri = "https://api.github.com/repos/microsoft/CsWinRT/releases/latest"
}
$URL = ((Invoke-RestMethod @Parameters).assets | Where-Object -FilterScript {$_.browser_download_url -match "nupkg"}).browser_download_url
$Parameters = @{
Uri = $URL
OutFile = "$PSScriptRoot\Microsoft.Windows.CsWinRT.nupkg"
Verbose = $true
}
Invoke-WebRequest @Parameters
Rename-Item -Path "$PSScriptRoot\Microsoft.Windows.CsWinRT.nupkg" -NewName "Microsoft.Windows.CsWinRT.zip" -Force
$Parameters = @{
Path = "$PSScriptRoot\Microsoft.Windows.CsWinRT.zip"
DestinationPath = "$PSScriptRoot\CsWinRT"
Force = $true
Verbose = $true
}
Expand-Archive @Parameters
New-Item -Path "Sophia Script for Windows 10 v$LatestRelease PowerShell 7\Libraries" -ItemType Directory -Force
$Parameters = @{
Path = @("$PSScriptRoot\sdk\lib\Microsoft.Windows.SDK.NET.dll", "$PSScriptRoot\CsWinRT\lib\net5.0\WinRT.Runtime.dll")
Destination = "Sophia Script for Windows 10 v$LatestRelease PowerShell 7\Libraries"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
$Parameters = @{
Path = "Sophia Script for Windows 10 v$LatestRelease PowerShell 7"
DestinationPath = "Sophia.Script.for.Windows.10.v$LatestRelease.PowerShell.7.zip"
Force = $true
}
Compress-Archive @Parameters
$Items = @(
"$PSScriptRoot\CsWinRT" ,
"$PSScriptRoot\SDK" ,
"$PSScriptRoot\Microsoft.Windows.CsWinRT.zip" ,
"$PSScriptRoot\Microsoft.Windows.SDK.NET.Ref.zip"
)
Remove-Item -Path $Items -Recurse -Force
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.v$LatestRelease.PowerShell.7.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
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/irm/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC
New-Item -Path "Sophia Script for Windows 10 LTSC v$LatestRelease" -ItemType Directory -Force
Write-Verbose -Message "Sophia Script for Windows 10 LTSC v$LatestRelease" -Verbose
Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.v$LatestRelease.zip" -Verbose
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10 LTSC" -Force | Copy-Item -Destination "Sophia Script for Windows 10 LTSC v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 10 LTSC v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.v$LatestRelease.zip"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.LTSC.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
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/irm/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
New-Item -Path "Sophia Script for Windows 11 v$LatestRelease" -ItemType Directory -Force
Write-Verbose -Message "Sophia Script for Windows 11 v$LatestRelease" -Verbose
Write-Verbose -Message "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Verbose
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"
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
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/irm/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7
New-Item -Path "Sophia Script for Windows 11 v$LatestRelease PowerShell 7" -ItemType Directory -Force
Write-Verbose -Message "Sophia Script for Windows 11 v$LatestRelease PowerShell 7" -Verbose
Write-Verbose -Message "Sophia.Script.for.Windows.11.v$LatestRelease.PowerShell.7.zip" -Verbose
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 11 PowerShell 7" -Force | Copy-Item -Destination "Sophia Script for Windows 11 v$LatestRelease PowerShell 7" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 11 v$LatestRelease PowerShell 7"
DestinationPath = "Sophia.Script.for.Windows.11.v$LatestRelease.PowerShell.7.zip"
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.11.v$LatestRelease.PowerShell.7.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name : Sophia Script Wrapper
run : |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/irm/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Wrapper
New-Item -Path "Sophia Script Wrapper v$LatestRelease" -ItemType Directory -Force
Write-Verbose -Message "Sophia Script Wrapper v$LatestRelease" -Verbose
Write-Verbose -Message "Sophia.Script.Wrapper.v$LatestRelease.zip" -Verbose
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"
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 : Upload archives to release
uses : svenstaro/upload-release-action@master
with :
repo_token : ${{ secrets.GITHUB_TOKEN }}
file : Sophia*.zip
tag : ${{ github.ref }}
overwrite : true
file_glob : true
prerelease : true
- name : Upload archives to release
uses : svenstaro/upload-release-action@master
with :
repo_token : ${{ secrets.GITHUB_TOKEN }}
file : SHA256SUM
tag : ${{ github.ref }}
overwrite : true
file_glob : true
prerelease : true