diff --git a/.github/workflows/deploy/chocolatey/asyncapi-cli.nuspec b/.github/workflows/deploy/chocolatey/asyncapi-cli.nuspec index bb797448364..70ee7484a1f 100644 --- a/.github/workflows/deploy/chocolatey/asyncapi-cli.nuspec +++ b/.github/workflows/deploy/chocolatey/asyncapi-cli.nuspec @@ -4,7 +4,7 @@ asyncapi {{version}} - https://github.com/asyncapi/cli/releases + https://github.com/asyncapi/cli/releases/v{{version}} AsyncAPI_Initiative diff --git a/.github/workflows/deploy/chocolatey/replace.ps1 b/.github/workflows/deploy/chocolatey/replace.ps1 index fcacc27eac8..c92cc866bda 100644 --- a/.github/workflows/deploy/chocolatey/replace.ps1 +++ b/.github/workflows/deploy/chocolatey/replace.ps1 @@ -1,6 +1,8 @@ param ( [Parameter(Mandatory=$true)] - [string]$version + [string]$version, + [string]$checksum, + [string]$checksum64 ) $filePaths = @( @@ -11,5 +13,7 @@ $filePaths = @( foreach ($filePath in $filePaths) { $fileContents = Get-Content $filePath $fileContents = $fileContents -replace '{{version}}', $version + $fileContents = $fileContents -replace '{{checksum}}', $checksum + $fileContents = $fileContents -replace '{{checksum64}}', $checksum64 Set-Content $filePath $fileContents } \ No newline at end of file diff --git a/.github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1 b/.github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1 index 5851aa3ba16..51049d73182 100644 --- a/.github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1 +++ b/.github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1 @@ -14,11 +14,10 @@ $packageArgs = @{ softwareName = 'asyncapi-cli*' - # TODO :- Change the checksum and checksumType to match the checksums for the above file. - # checksum = '' - # checksumType = 'sha256' #default is md5, can also be sha1, sha256 or sha512 - # checksum64 = '' - # checksumType64= 'sha256' #default is checksumType + checksum = '{{checksum}}' + checksumType = 'sha256' #default is md5, can also be sha1, sha256 or sha512 + checksum64 = '{{checksum64}}' + checksumType64= 'sha256' #default is checksumType validExitCodes= @(0, 3010, 1641) silentArgs = '/S' # NSIS diff --git a/.github/workflows/release-chocolatey.yml b/.github/workflows/release-chocolatey.yml index b660240565c..8aef0996e4c 100644 --- a/.github/workflows/release-chocolatey.yml +++ b/.github/workflows/release-chocolatey.yml @@ -18,6 +18,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + - name: Set Version id: release_version run: | @@ -29,16 +30,36 @@ jobs: } echo "Setting version to $version" echo "version=$version" >> $env:GITHUB_OUTPUT + + - name: Download release + run: | + echo "Downloading release assets for version ${{ steps.release_version.outputs.version }}" + mkdir -p ./dist/win32 + curl -L "https://github.com/asyncapi/cli/releases/download/v${{ steps.release_version.outputs.version }}/asyncapi.x64.exe" -o "./dist/win32/asyncapi.x64.exe" + curl -L "https://github.com/asyncapi/cli/releases/download/v${{ steps.release_version.outputs.version }}/asyncapi.x86.exe" -o "./dist/win32/asyncapi.x86.exe" + + - name: Get Checksum of the release + id: release_checksum + run: | + $checksum = (Get-FileHash -Path "./dist/win32/asyncapi.x86.exe" -Algorithm SHA256).Hash + $checksum64 = (Get-FileHash -Path "./dist/win32/asyncapi.x64.exe" -Algorithm SHA256).Hash + echo "Setting checksum to $checksum" + echo "checksum=$checksum" >> $env:GITHUB_OUTPUT + echo "Setting checksum64 to $checksum64" + echo "checksum64=$checksum64" >> $env:GITHUB_OUTPUT + - name: Make nuspec from the template run: | cd ./.github/workflows/deploy/chocolatey - pwsh -File ./replace.ps1 -version ${{ steps.release_version.outputs.version }} + pwsh -File ./replace.ps1 -version ${{ steps.release_version.outputs.version }} -checksum ${{ steps.release_checksum.outputs.checksum }} -checksum64 ${{ steps.release_checksum.outputs.checksum64 }} + - name: Run Chocolatey Pack run: | cd ./.github/workflows/deploy/chocolatey choco pack ./asyncapi-cli.nuspec choco apikey add --source "'https://push.chocolatey.org/'" --key ${{ secrets.CHOCOLATEY_API_KEY }} choco push ./asyncapi.${{ steps.release_version.outputs.version }}.nupkg --source "'https://push.chocolatey.org/'" + - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel name: Report workflow run status to Slack uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #using https://github.com/8398a7/action-slack/releases/tag/v3.15.1