Browse Source

Update Sophia.yml

pull/264/head
Dmitry Nefedov 3 years ago
committed by GitHub
parent
commit
27a71564ba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 211
      .github/workflows/Sophia.yml

211
.github/workflows/Sophia.yml

@ -12,60 +12,53 @@ jobs:
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- uses: actions/checkout@master - uses: actions/checkout@master
- name: PowerShell 5.1 - name: Sophia Script for Windows 10
run: | run: |
$BUILD_DIR = "Sophia Script v" # https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
if ($env:GITHUB_REF -eq "refs/heads/master") $Parameters = @{
{ Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
$BUILD_DIR += "master"
}
else
{
$BUILD_DIR += ${env:GITHUB_REF} -replace "refs/tags/", ""
} }
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1
$ZIP = "$BUILD_DIR.zip" New-Item -Path "Sophia Script for Windows 10 v$LatestRelease" -ItemType Directory
New-Item -Path $BUILD_DIR -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
Write-Host $BUILD_DIR Get-ChildItem -Path "Sophia Script for Windows 10" -Recurse | Copy-Item -Destination "Sophia Script for Windows 10 v$LatestRelease" -Recurse
Write-Host $ZIP
Get-ChildItem -Path "Sophia\PowerShell 5.1" | Copy-Item -Destination $BUILD_DIR -Recurse -Force $Parameters = @{
Compress-Archive -Path $BUILD_DIR -DestinationPath $ZIP -Force Path = "Sophia Script for Windows 10 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.v$LatestRelease.zip"
CompressionLevel = "Fastest"
}
Compress-Archive @Parameters
# Calculate hash # Calculate hash
Get-Item -Path $ZIP -Force | ForEach-Object -Process { Get-Item -Path "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)" "$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force } | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: PowerShell 7 - name: Sophia Script for Windows 10 PowerShell 7
run: | run: |
$BUILD_DIR = "Sophia Script v" # https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
if ($env:GITHUB_REF -eq "refs/heads/master") $Parameters = @{
{ Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
$BUILD_DIR += "master"
}
else
{
$BUILD_DIR += ${env:GITHUB_REF} -replace "refs/tags/", ""
} }
$BUILD_DIR += " PowerShell 7" $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7
$ZIP = "$BUILD_DIR.zip"
New-Item -Path $BUILD_DIR -ItemType Directory -Force New-Item -Path "Sophia Script for Windows 10 v$LatestRelease PowerShell 7" -ItemType Directory
Write-Host $BUILD_DIR Write-Verbose -Message "Sophia Script for Windows 10 v$LatestRelease PowerShell 7" -Verbose
Write-Host $ZIP Write-Verbose -Message "Sophia.Script.for.Windows.10.v$LatestRelease.PowerShell.7zip" -Verbose
Get-ChildItem -Path "Sophia\PowerShell 7" | Copy-Item -Destination $BUILD_DIR -Recurse -Force Get-ChildItem -Path "Sophia Script for Windows 10 PowerShell 7" -Recurse | Copy-Item -Destination "Sophia Script for Windows 10 v$LatestRelease PowerShell 7" -Recurse
# Download Microsoft.Windows.SDK.NET.Ref # Download Microsoft.Windows.SDK.NET.Ref
$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"
OutFile = "$PSScriptRoot\microsoft.windows.sdk.net.ref.nupkg" OutFile = "$PSScriptRoot\microsoft.windows.sdk.net.ref.nupkg"
Verbose = [switch]::Present Verbose = $true
} }
Invoke-WebRequest @Parameters Invoke-WebRequest @Parameters
@ -74,20 +67,21 @@ jobs:
$Parameters = @{ $Parameters = @{
Path = "$PSScriptRoot\Microsoft.Windows.SDK.NET.Ref.zip" Path = "$PSScriptRoot\Microsoft.Windows.SDK.NET.Ref.zip"
DestinationPath = "$PSScriptRoot\SDK" DestinationPath = "$PSScriptRoot\SDK"
Force = [switch]::Present Force = $true
Verbose = [switch]::Present Verbose = $true
} }
Expand-Archive @Parameters Expand-Archive @Parameters
# Download CsWinRT # Download CsWinRT
$LatestRelease = (Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/CsWinRT/releases").tag_name | Select-Object -First 1 $Parameters = @{
$Download = ((Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/CsWinRT/releases") | Where-Object -FilterScript {$_.tag_name -eq $LatestRelease}).assets | Where-Object -FilterScript {$_.browser_download_url -match "nupkg"} Uri = "https://api.github.com/repos/microsoft/CsWinRT/releases/latest"
$URL = $Download.browser_download_url }
$URL = (Invoke-RestMethod @Parameters).assets | Where-Object -FilterScript {$_.browser_download_url -match "nupkg"}).browser_download_url
$Parameters = @{ $Parameters = @{
Uri = $URL Uri = $URL
OutFile = "$PSScriptRoot\Microsoft.Windows.CsWinRT.nupkg" OutFile = "$PSScriptRoot\Microsoft.Windows.CsWinRT.nupkg"
Verbose = [switch]::Present Verbose = $true
} }
Invoke-WebRequest @Parameters Invoke-WebRequest @Parameters
@ -96,87 +90,140 @@ jobs:
$Parameters = @{ $Parameters = @{
Path = "$PSScriptRoot\Microsoft.Windows.CsWinRT.zip" Path = "$PSScriptRoot\Microsoft.Windows.CsWinRT.zip"
DestinationPath = "$PSScriptRoot\CsWinRT" DestinationPath = "$PSScriptRoot\CsWinRT"
Force = [switch]::Present Force = $true
Verbose = [switch]::Present Verbose = $true
} }
Expand-Archive @Parameters Expand-Archive @Parameters
New-Item -Path $BUILD_DIR\Libraries -ItemType Directory -Force New-Item -Path "Sophia Script for Windows 10 v$LatestRelease PowerShell 7\Libraries" -ItemType Directory -Force
Copy-Item -Path "$PSScriptRoot\sdk\lib\Microsoft.Windows.SDK.NET.dll" -Destination $BUILD_DIR\Libraries -Recurse -Force $Parameters = @{
Copy-Item -Path "$PSScriptRoot\CsWinRT\lib\net5.0\WinRT.Runtime.dll" -Destination $BUILD_DIR\Libraries -Recurse -Force Path = "$PSScriptRoot\sdk\lib\Microsoft.Windows.SDK.NET.dll", "$PSScriptRoot\CsWinRT\lib\net5.0\WinRT.Runtime.dll"
DestinationPath = "Sophia Script for Windows 10 v$LatestRelease PowerShell 7\Libraries"
Recurse = $true
}
Copy-Item @Parameters
Compress-Archive -Path $BUILD_DIR -DestinationPath $ZIP -Force $Parameters = @{
Path = "Sophia Script for Windows 10 v$LatestRelease PowerShell 7"
DestinationPath = "Sophia.Script.for.Windows.10.v$LatestRelease.PowerShell.7.zip"
}
Compress-Archive @Parameters
Remove-Item -Path "$PSScriptRoot\CsWinRT", "$PSScriptRoot\SDK" -Recurse -Force $Items = @(
Remove-Item -Path "$PSScriptRoot\Microsoft.Windows.CsWinRT.zip", "$PSScriptRoot\Microsoft.Windows.SDK.NET.Ref.zip" -Force "$PSScriptRoot\CsWinRT",
"$PSScriptRoot\SDK",
"$PSScriptRoot\Microsoft.Windows.CsWinRT.zip",
"$PSScriptRoot\Microsoft.Windows.SDK.NET.Ref.zip"
)
Remove-Item -Path $Items -Recurse -Force
# Calculate hash # Calculate hash
Get-Item -Path $ZIP -Force | ForEach-Object -Process { 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)" "$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force } | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Build LTSC - name: Sophia Script for Windows 10 LTSC
run: | run: |
$ModuleVersion = (Import-PowerShellDataFile -Path "Sophia\LTSC\Manifest\Sophia.psd1").ModuleVersion # https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
Write-Host $ModuleVersion $Parameters = @{
$BUILD_DIR = "Sophia Script LTSC v$ModuleVersion" Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
$ZIP = "$BUILD_DIR.zip" }
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC
New-Item -Path $BUILD_DIR -ItemType Directory -Force New-Item -Path "Sophia Script for Windows 10 LTSC v$LatestRelease" -ItemType Directory -Force
Write-Host $BUILD_DIR Write-Verbose -Message "Sophia Script for Windows 10 LTSC v$LatestRelease" -Verbose
Write-Host $ZIP Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.v$LatestRelease.zip" -Verbose
Get-ChildItem -Path Sophia\LTSC | Copy-Item -Destination $BUILD_DIR -Recurse -Force Get-ChildItem -Path "Sophia Script for Windows 10 LTSC" -Recurse | Copy-Item -Destination "Sophia Script for Windows 10 LTSC v$LatestRelease" -Recurse
Compress-Archive -Path $BUILD_DIR -DestinationPath $ZIP -Force $Parameters = @{
Path = "Sophia Script for Windows 10 LTSC v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.v$LatestRelease.zip"
}
Compress-Archive @Parameters
# Calculate hash # Calculate hash
Get-Item -Path $ZIP -Force | ForEach-Object -Process { Get-Item -Path "Sophia.Script.for.Windows.10.LTSC.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)" "$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force } | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Build Windows 11 - name: Sophia Script for Windows 11
run: | run: |
$ModuleVersion = (Import-PowerShellDataFile -Path "Sophia\Windows 11\Manifest\Sophia.psd1").ModuleVersion # https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
Write-Host $ModuleVersion $Parameters = @{
$BUILD_DIR = "Sophia Script Windows 11 v$ModuleVersion" Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
$ZIP = "$BUILD_DIR.zip" }
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
New-Item -Path $BUILD_DIR -ItemType Directory -Force New-Item -Path "Sophia Script for Windows 11 v$LatestRelease" -ItemType Directory -Force
Write-Host $BUILD_DIR Write-Verbose -Message "Sophia Script for Windows 11 v$LatestRelease" -Verbose
Write-Host $ZIP Write-Verbose -Message "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Verbose
Get-ChildItem -Path "Sophia\Windows 11" | Copy-Item -Destination $BUILD_DIR -Recurse -Force Get-ChildItem -Path "Sophia Script for Windows 11" -Recurse | Copy-Item -Destination "Sophia Script for Windows 11 v$LatestRelease" -Recurse
Compress-Archive -Path $BUILD_DIR -DestinationPath $ZIP -Force $Parameters = @{
Path = "Sophia Script for Windows 11 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.v$LatestRelease.zip"
}
Compress-Archive @Parameters
# Calculate hash # Calculate hash
Get-Item -Path $ZIP -Force | ForEach-Object -Process { Get-Item -Path "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)" "$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force } | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Wrapper - name: Sophia Script for Windows 11 PowerShell 7
run: | run: |
# The Trim.() is needed to trim the downloaded text version string # https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$WrapperVersion = (Invoke-RestMethod -Uri "https://raw.githubusercontent.com/farag2/Windows-10-Sophia-Script/master/Wrapper/latest.txt").ToString().Trim() $Parameters = @{
Write-Host $WrapperVersion Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
$BUILD_DIR = "Sophia Script Wrapper v$WrapperVersion" }
$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
$ZIP = "$BUILD_DIR.zip" Get-ChildItem -Path "Sophia Script for Windows 11 PowerShell 7" -Recurse | Copy-Item -Destination "Sophia Script for Windows 11 v$LatestRelease PowerShell 7" -Recurse
New-Item -Path $BUILD_DIR -ItemType Directory -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
Write-Host $BUILD_DIR # Calculate hash
Write-Host $ZIP 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
Get-ChildItem -Path Wrapper -Exclude latest.txt, README.md | Copy-Item -Destination $BUILD_DIR -Recurse -Force - name: Sophia Script Wrapper
Compress-Archive -Path $BUILD_DIR -DestinationPath $ZIP -Force 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/master/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 -Recurse | Copy-Item -Destination "Sophia Script Wrapper v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script Wrapper v$LatestRelease"
DestinationPath = "Sophia.Script.Wrapper.v$LatestRelease.zip"
}
Compress-Archive @Parameters
# Calculate hash # Calculate hash
Get-ChildItem -Path $ZIP -Force | ForEach-Object -Process { Get-ChildItem -Path "Sophia.Script.Wrapper.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)" "$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force } | Add-Content -Path SHA256SUM -Encoding Default -Force

Loading…
Cancel
Save