chore: update release workflow to include Chocolatey package publishing

This commit is contained in:
HueByte
2026-02-24 22:12:26 +01:00
parent ed7d0a73a3
commit 1b6c27247f
2 changed files with 29 additions and 11 deletions
+27 -11
View File
@@ -12,6 +12,10 @@ jobs:
release:
name: Create Release
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.changes.outputs.src_changed == 'true' && steps.check_release.outputs.exists == 'false' }}
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
@@ -158,21 +162,33 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Chocolatey package
if: steps.changes.outputs.src_changed == 'true' && steps.check_release.outputs.exists == 'false'
choco:
name: Publish to Chocolatey
needs: release
if: needs.release.outputs.should_release == 'true'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Download release asset
run: gh release download "v${{ needs.release.outputs.version }}" --pattern "EchoHub-Client-win-x64.zip"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Pack and push
shell: pwsh
run: |
VERSION="${{ steps.version.outputs.version }}"
CHECKSUM=$(sha256sum EchoHub-Client-win-x64.zip | awk '{print $1}')
$version = "${{ needs.release.outputs.version }}"
$checksum = (Get-FileHash EchoHub-Client-win-x64.zip -Algorithm SHA256).Hash.ToLower()
# Stamp version and checksum into package templates
sed -i "s/__VERSION__/$VERSION/g" packaging/choco/echohub.nuspec
sed -i "s/__VERSION__/$VERSION/g" packaging/choco/tools/chocolateyInstall.ps1
sed -i "s/__CHECKSUM64__/$CHECKSUM/g" packaging/choco/tools/chocolateyInstall.ps1
(Get-Content packaging/choco/echohub.nuspec) -replace '__VERSION__', $version | Set-Content packaging/choco/echohub.nuspec
(Get-Content packaging/choco/tools/chocolateyInstall.ps1) -replace '__VERSION__', $version | Set-Content packaging/choco/tools/chocolateyInstall.ps1
(Get-Content packaging/choco/tools/chocolateyInstall.ps1) -replace '__CHECKSUM64__', $checksum | Set-Content packaging/choco/tools/chocolateyInstall.ps1
# Build and push the package
mkdir -p /tmp/choco-out
cd packaging/choco
choco pack echohub.nuspec --output-directory /tmp/choco-out
choco push /tmp/choco-out/echohub.*.nupkg --source https://push.chocolatey.org/ --api-key "$CHOCO_API_KEY"
choco pack echohub.nuspec --output-directory $env:TEMP
$pkg = Get-ChildItem "$env:TEMP\echohub.*.nupkg" | Select-Object -First 1
choco push $pkg.FullName --source https://push.chocolatey.org/ --api-key $env:CHOCO_API_KEY
env:
CHOCO_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}