Skip to content

Commit 9794a28

Browse files
committed
Fix Chocolatey build: Use Windows runner with proper Chocolatey installation
1 parent 99fe20d commit 9794a28

File tree

1 file changed

+43
-11
lines changed

1 file changed

+43
-11
lines changed

.github/workflows/release.yml

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,56 @@ jobs:
3232
version: latest
3333
args: check
3434

35-
- name: Install Chocolatey CLI
36-
run: |
37-
sudo apt update
38-
sudo apt install -y mono-complete
39-
wget https://community.chocolatey.org/install.ps1 -O - | sudo bash
40-
# Verify choco is in PATH and accessible
41-
which choco || echo "choco not found in PATH"
42-
choco --version || echo "choco command failed"
43-
4435
- name: Run GoReleaser
4536
uses: goreleaser/goreleaser-action@v6
4637
with:
4738
version: latest
48-
args: release --clean
39+
args: release --clean --skip=chocolatey
4940
env:
5041
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5142
# Custom tokens for package manager repositories
5243
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
5344
SCOOP_BUCKET_TOKEN: ${{ secrets.SCOOP_BUCKET_TOKEN }}
54-
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
5545

46+
chocolatey:
47+
name: Build Chocolatey Package
48+
runs-on: windows-latest
49+
needs: release
50+
permissions:
51+
contents: write
52+
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0
58+
59+
- name: Set up Go
60+
uses: actions/setup-go@v5
61+
with:
62+
go-version: "1.24.4"
63+
64+
- name: Install Chocolatey
65+
shell: pwsh
66+
run: |
67+
Set-ExecutionPolicy Bypass -Scope Process -Force
68+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
69+
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
70+
71+
- name: Verify Chocolatey installation
72+
shell: pwsh
73+
run: |
74+
# Refresh environment to pick up Chocolatey PATH
75+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
76+
choco --version
77+
78+
- name: Run GoReleaser (Chocolatey only)
79+
uses: goreleaser/goreleaser-action@v6
80+
with:
81+
version: latest
82+
args: release --clean --skip=homebrew,scoop,winget,nfpm
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
86+
# Ensure Chocolatey is in PATH for GoReleaser
87+
Path: ${{ env.Path }};C:\ProgramData\chocolatey\bin

0 commit comments

Comments
 (0)