Skip to content

Commit f92444b

Browse files
committed
Fix Chocolatey job: Use --skip=publish and manually publish Chocolatey package to avoid GitHub release conflicts
1 parent 7be93db commit f92444b

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,27 @@ jobs:
6767
shell: pwsh
6868
run: choco --version
6969

70-
- name: Run GoReleaser (Chocolatey only)
70+
- name: Build and package with GoReleaser (skip publishing)
7171
uses: goreleaser/goreleaser-action@v6
7272
with:
7373
distribution: goreleaser
7474
version: '~> v2'
75-
args: release --clean --skip=homebrew,scoop,winget,nfpm,release
75+
args: release --clean --skip=homebrew,scoop,winget,nfpm,publish
7676
env:
7777
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
79+
80+
- name: Publish Chocolatey package
81+
shell: pwsh
82+
run: |
83+
$nupkg = Get-ChildItem -Path dist -Filter "*.nupkg" -Recurse | Select-Object -First 1
84+
if ($nupkg) {
85+
Write-Host "Publishing Chocolatey package: $($nupkg.FullName)"
86+
choco push $nupkg.FullName --source https://push.chocolatey.org/ --api-key $env:CHOCOLATEY_API_KEY --force
87+
} else {
88+
Write-Error "No .nupkg file found in dist directory"
89+
Get-ChildItem -Path dist -Recurse | ForEach-Object { Write-Host $_.FullName }
90+
exit 1
91+
}
92+
env:
7893
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}

0 commit comments

Comments
 (0)