Script to setup Windows 10 1903
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

48 lines
3.0 KiB

name: Chocolatey push
on:
workflow_dispatch:
jobs:
Push:
name: Push
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@main
- name: Getting hashes
run: |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/SHA256SUM.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/refs/heads/master/SHA256SUM.json"
UseBasicParsing = $true
Verbose = $true
}
$SHA256SUM = Invoke-RestMethod @Parameters
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$Latest_Release = Invoke-RestMethod @Parameters
# Replace variables with script latest versions
# No need to replace special characters with percent-encoding ones
(Get-Content -Path "chocolatey\tools\chocolateyinstall.ps1" -Encoding utf8 -Raw) | Foreach-Object -Process {
$_ -replace "Hash_Sophia_Script_Windows_10_PowerShell_5_1", $SHA256SUM."Sophia.Script.for.Windows.10.v$($Latest_Release.Sophia_Script_Windows_10_PowerShell_5_1).zip" `
-replace "Hash_Sophia_Script_Windows_10_PowerShell_7", $SHA256SUM."Sophia.Script.for.Windows.10.PowerShell.7.v$($Latest_Release.Sophia_Script_Windows_10_PowerShell_7).zip" `
-replace "Hash_Sophia_Script_Windows_10_LTSC2019", $SHA256SUM."Sophia.Script.for.Windows.10.LTSC.2019.v$($Latest_Release.Sophia_Script_Windows_10_LTSC2019).zip" `
-replace "Hash_Sophia_Script_Windows_10_LTSC2021", $SHA256SUM."Sophia.Script.for.Windows.10.LTSC.2021.v$($Latest_Release.Sophia_Script_Windows_10_LTSC2021).zip" `
-replace "Hash_Sophia_Script_Windows_11_PowerShell_5_1", $SHA256SUM."Sophia.Script.for.Windows.11.v$($env:Latest_Release_Windows_11_PowerShell_5_1).zip" `
-replace "Hash_Sophia_Script_Windows_11_PowerShell_7", $SHA256SUM."Sophia.Script.for.Windows.11.PowerShell.7.v$($Latest_Release.Sophia_Script_Windows_11_PowerShell_7).zip" `
-replace "Hash_Sophia_Script_Windows_11_LTSC2024", $SHA256SUM."Sophia.Script.for.Windows.11.LTSC.2024.v$($Latest_Release.Sophia_Script_Windows_11_LTSC2024).zip" `
-replace "Hash_Sophia_Script_Wrapper", $SHA256SUM."Sophia.Script.Wrapper.v$($Latest_Release.Sophia_Script_Wrapper).zip"
} | Set-Content -Path "chocolatey\tools\chocolateyinstall.ps1" -Encoding utf8 -Force
- name: Pack and push to Chocolatey
run: |
choco pack chocolatey\sophia.nuspec --outputdirectory chocolatey
choco apikey --key ${{ secrets.CHOCOLATEY_SECRET }} --source https://push.chocolatey.org/
[xml]$Version = Get-Content -Path chocolatey\sophia.nuspec
[string]$Version = $Version.package.metadata.version
choco push chocolatey\sophia.$Version.nupkg --source https://push.chocolatey.org/ --yes