github.com/kubeshop/testkube@v1.17.23/choco/update.ps1 (about)

     1  $version = $args[0]
     2  $api_key = $args[1]
     3  $chocolatey_repo = $args[2]
     4  
     5  #update verification.txt and chocolateyInstall.ps1 files
     6  $folder = "tools"
     7  $files_to_update = "$folder\VERIFICATION.txt", "$folder\chocolateyInstall.ps1"
     8  
     9  foreach ($file in $files_to_update) {
    10      $script_path = "$PSScriptRoot\$file"
    11      $content    = Get-Content $script_path -Raw
    12  
    13      Write-Host "Updating $file file with version: $version"
    14      $update_version = $content -replace "\d+\.\d+\.\d+", "$version"
    15      Set-Content -Path $script_path -Value $update_version -NoNewline
    16  }
    17  
    18  #update testkube.nuspec
    19  $file = "testkube.nuspec"
    20  $file_content  = Get-Content $file -Raw  
    21  
    22  Write-Host "Updating $file file with version: $version"
    23  $update_version = $file_content -replace ">\d+\.\d+\.\d+<", ">$version<"
    24  Set-Content -Path $file -Value $update_version -NoNewline
    25  
    26  #package with chocolatey
    27  choco pack
    28  
    29  #push package
    30  choco push .\Testkube.$version.nupkg --key $api_key --source $chocolatey_repo