Skip to content

Commit

Permalink
chore: update chocolatey packaging info and workflows (#1048)
Browse files Browse the repository at this point in the history
Co-authored-by: souvik <[email protected]>
  • Loading branch information
Shurtu-gal and Souvikns authored Jan 8, 2024
1 parent 9dc0d53 commit e198854
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 237 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/deploy/chocolatey/asyncapi-cli.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@
<metadata>
<id>asyncapi</id>
<version>{{version}}</version>
<packageSourceUrl>https://github.com/asyncapi/cli/releases</packageSourceUrl>
<owners>AsyncAPI, shurtugal</owners>
<packageSourceUrl>https://github.com/asyncapi/cli/releases/v{{version}}</packageSourceUrl>
<owners>AsyncAPI_Initiative</owners>

<!-- == SOFTWARE SPECIFIC SECTION == -->
<!-- This section is about the software itself -->
<title>asyncapi-cli</title>
<authors>AsyncAPI, shurtugal</authors>
<authors>AsyncAPI_Initiative</authors>
<projectUrl>https://www.asyncapi.com/</projectUrl>
<iconUrl>https://avatars.githubusercontent.com/u/16401334?s=200</iconUrl>
<copyright>2023 AsyncAPI</copyright>
<copyright>2023 AsyncAPI Initiative</copyright>
<licenseUrl>https://github.com/asyncapi/cli/blob/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>https://github.com/asyncapi/cli/releases/v{{version}}</releaseNotes>
<projectSourceUrl>https://github.com/asyncapi/cli</projectSourceUrl>
<docsUrl>https://www.asyncapi.com/docs/tools/cli</docsUrl>
<bugTrackerUrl>https://github.com/asyncapi/cli/issues/new/choose</bugTrackerUrl>
<tags>asyncapi-cli cli nodejs api asyncapi</tags>
<summary>CLI to work with your AsyncAPI files. You can validate them and in the future use a generator and even bootstrap a new file. Contributions are welcomed!</summary>
<description>CLI to work with your AsyncAPI files. You can validate them and in the future use a generator and even bootstrap a new file. Contributions are welcomed!</description>
</metadata>
<files>
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/deploy/chocolatey/replace.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
param (
[Parameter(Mandatory=$true)]
[string]$version
[string]$version,
[string]$checksum,
[string]$checksum64
)

$filePaths = @(
Expand All @@ -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
}
207 changes: 0 additions & 207 deletions .github/workflows/deploy/chocolatey/tools/LICENSE.txt

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/deploy/chocolatey/tools/VERIFICATION.txt

This file was deleted.

26 changes: 5 additions & 21 deletions .github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,15 @@ $packageArgs = @{
url64bit = $url64
#file = $fileLocation NOTE: Commented out because we are using url instead

softwareName = 'asyncapi-cli*' #part or all of the Display Name as you see it in Programs and Features. It should be enough to be unique
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

# MSI
# silentArgs = "/qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`"" # ALLUSERS=1 DISABLEDESKTOPSHORTCUT=1 ADDDESKTOPICON=0 ADDSTARTMENU=0
validExitCodes= @(0, 3010, 1641)
# OTHERS
# Uncomment matching EXE type (sorted by most to least common)
silentArgs = '/S' # NSIS
#silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' # Inno Setup
#silentArgs = '/s' # InstallShield
#silentArgs = '/s /v"/qn"' # InstallShield with MSI
#silentArgs = '/s' # Wise InstallMaster
#silentArgs = '-s' # Squirrel
#silentArgs = '-q' # Install4j
#silentArgs = '-s' # Ghost
# Note that some installers, in addition to the silentArgs above, may also need assistance of AHK to achieve silence.
#silentArgs = '' # none; make silent with input macro script like AutoHotKey (AHK)
# https://community.chocolatey.org/packages/autohotkey.portable
#validExitCodes= @(0) #please insert other valid exit codes here
}

Install-ChocolateyPackage @packageArgs # https://docs.chocolatey.org/en-us/create/functions/install-chocolateypackage
23 changes: 22 additions & 1 deletion .github/workflows/release-chocolatey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set Version
id: release_version
run: |
Expand All @@ -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
Expand Down

0 comments on commit e198854

Please sign in to comment.