|
|
@ -11,7 +11,7 @@ jobs: |
|
|
|
- name: Checkout Repository |
|
|
|
uses: actions/checkout@main |
|
|
|
|
|
|
|
- name: Getting hashes |
|
|
|
- name: Preparation |
|
|
|
run: | |
|
|
|
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/SHA256SUM.json |
|
|
|
$Parameters = @{ |
|
|
@ -27,7 +27,6 @@ jobs: |
|
|
|
$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" ` |
|
|
@ -39,8 +38,17 @@ jobs: |
|
|
|
-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 |
|
|
|
|
|
|
|
# Save latest release tag for sophia.nuspec |
|
|
|
$Latest_Release = $Latest_Release.Sophia_Script_Windows_11_PowerShell_5_1 |
|
|
|
echo "Latest_Release=$Latest_Release" >> $env:GITHUB_ENV |
|
|
|
|
|
|
|
- name: Pack and push to Chocolatey |
|
|
|
run: | |
|
|
|
Write-Verbose -Message "${{ env.Latest_Release }}" -Verbose |
|
|
|
|
|
|
|
# Replace variables with script latest versions |
|
|
|
(Get-Content -Path "chocolatey\sophia.nuspec" -Encoding utf8NoBOM -Raw) -replace ("SophiaScriptVersion", "${{ env.Latest_Release }}") | Set-Content -Path "chocolatey\sophia.nuspec" -Encoding utf8NoBOM -Force |
|
|
|
|
|
|
|
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 |