From 4d2bffb2055404e960520e41d551a4ab48ced339 Mon Sep 17 00:00:00 2001 From: Filipe PINTO Date: Thu, 26 Jan 2023 14:08:45 +0100 Subject: [PATCH] Update chocolatey contrib --- .../chocolatey/README.md | 26 ++++++++++++++++--- .../chocolatey/hurl/hurl.nuspec | 17 +++++++----- .../hurl/tools/chocolateyinstall.ps1 | 4 +-- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/contrib/windows/windows_package_managers/chocolatey/README.md b/contrib/windows/windows_package_managers/chocolatey/README.md index dbacc67f5..299605dfe 100644 --- a/contrib/windows/windows_package_managers/chocolatey/README.md +++ b/contrib/windows/windows_package_managers/chocolatey/README.md @@ -1,11 +1,29 @@ # how to manage hurl chocolatey package -Get sha256 sum of the new hurl-x.y.z-win64.zip file + +Get latest released version ``` -Get-FileHash -Path \hurl-..-win64.zip +$hurl_latest_version=((Invoke-WebRequest -UseBasicParsing https://api.github.com/repos/Orange-OpenSource/hurl/releases/latest).content | ConvertFrom-Json | Select -exp tag_name) +echo ${hurl_latest_version} ``` -Update *.nuspec and tools/*.ps1 files with new version and sum values, then execute local installer: +Get latest released hurl-x.y.z-win64.zip file's sha256 sum + +``` +Invoke-WebRequest -UseBasicParsing https://github.com/Orange-OpenSource/hurl/releases/download/${hurl_latest_version}/hurl-${hurl_latest_version}-win64.zip -OutFile C:\Windows\Temp\hurl-latest-win64.zip +$hurl_latest_sha=(Get-FileHash C:\Windows\Temp\hurl-latest-win64.zip).Hash +echo ${hurl_latest_sha} +``` + +Update choco package files with the latest released version and sha256 sum + +``` +(Get-Content -Path hurl.nuspec) | foreach{$_.replace('${hurl_latest_version}',${hurl_latest_version})} | Set-Content hurl.nuspec +(Get-Content -Path tools\chocolateyinstall.ps1) | foreach{$_.replace('${hurl_latest_version}',${hurl_latest_version})} | Set-Content tools\chocolateyinstall.ps1 +(Get-Content -Path tools\chocolateyinstall.ps1) | foreach{$_.replace('${hurl_latest_sha}',${hurl_latest_sha})} | Set-Content tools\chocolateyinstall.ps1 +``` + +Execute local installer: ``` choco pack @@ -14,7 +32,7 @@ hurl --version echo "GET https://google.fr" | hurl --location ``` -and finally push package to official chocolatey repository +And finally push package to official chocolatey repository ``` choco apikey -k -source https://push.chocolatey.org/ diff --git a/contrib/windows/windows_package_managers/chocolatey/hurl/hurl.nuspec b/contrib/windows/windows_package_managers/chocolatey/hurl/hurl.nuspec index efcedeed6..b943d140f 100644 --- a/contrib/windows/windows_package_managers/chocolatey/hurl/hurl.nuspec +++ b/contrib/windows/windows_package_managers/chocolatey/hurl/hurl.nuspec @@ -2,7 +2,7 @@ hurl - {version} + ${hurl_latest_version} Hurl Fabrice REIX, Jean Christophe AMIEL, Orange-OpenSource Orange-OpenSource @@ -16,14 +16,19 @@ https://github.com/Orange-OpenSource/hurl/issues hurl curl http https cli http-client testing-tool integration-tool automation-tool api-testing cross-platform Hurl is a command line tool that runs HTTP requests defined in a simple plain text format - + - + ]]> + + + + + diff --git a/contrib/windows/windows_package_managers/chocolatey/hurl/tools/chocolateyinstall.ps1 b/contrib/windows/windows_package_managers/chocolatey/hurl/tools/chocolateyinstall.ps1 index 19644dbb3..43f45efc0 100644 --- a/contrib/windows/windows_package_managers/chocolatey/hurl/tools/chocolateyinstall.ps1 +++ b/contrib/windows/windows_package_managers/chocolatey/hurl/tools/chocolateyinstall.ps1 @@ -5,8 +5,8 @@ $SoftwareName = 'hurl' $HashArguments = @{ PackageName = $env:ChocolateyPackageName UnzipLocation = $(Split-Path -Parent $MyInvocation.MyCommand.Definition) - Url64 = 'https://github.com/Orange-OpenSource/hurl/releases/download/{version}/hurl-{version}-win64.zip' - Checksum64 = '{Checksum64}' + Url64 = 'https://github.com/Orange-OpenSource/hurl/releases/download/${hurl_latest_version}/hurl-${hurl_latest_version}-win64.zip' + Checksum64 = '${hurl_latest_sha}' ChecksumType64 = 'sha256' }