Skip to content

Commit 9d91e4a

Browse files
authored
chore: add chocolatey (#4615)
1 parent 1f46a11 commit 9d91e4a

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

.github/workflows/tag.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,30 @@ on:
77
jobs:
88
release:
99
runs-on: ubuntu-latest
10+
env:
11+
# https://github.com/actions/setup-go#supported-version-syntax
12+
# ex:
13+
# - 1.18beta1 -> 1.18.0-beta.1
14+
# - 1.18rc1 -> 1.18.0-rc.1
15+
GO_VERSION: '1.22'
16+
CHOCOLATEY_VERSION: 2.2.0
1017
steps:
1118
- uses: actions/checkout@v4
1219
- name: Install Go
1320
uses: actions/setup-go@v5
1421
with:
15-
# https://github.com/actions/setup-go#supported-version-syntax
16-
# ex:
17-
# - 1.18beta1 -> 1.18.0-beta.1
18-
# - 1.18rc1 -> 1.18.0-rc.1
19-
go-version: '1.22'
22+
go-version: ${{ env.GO_VERSION }}
2023
- name: Unshallow
2124
run: git fetch --prune --unshallow
2225

26+
- name: Install chocolatey
27+
run: |
28+
mkdir -p /opt/chocolatey
29+
wget -q -O - "https://github.com/chocolatey/choco/releases/download/${CHOCOLATEY_VERSION}/chocolatey.v${CHOCOLATEY_VERSION}.tar.gz" | tar -xz -C "/opt/chocolatey"
30+
echo '#!/bin/bash' >> /usr/local/bin/choco
31+
echo 'mono /opt/chocolatey/choco.exe $@' >> /usr/local/bin/choco
32+
chmod +x /usr/local/bin/choco
33+
2334
- name: Set up QEMU
2435
uses: docker/setup-qemu-action@v3
2536

@@ -35,4 +46,5 @@ jobs:
3546
version: latest
3647
args: release --clean --timeout=90m
3748
env:
49+
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
3850
GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }}

.goreleaser.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,32 @@ brews:
9999
test: |
100100
system "#{bin}/golangci-lint --version"
101101
102+
chocolateys:
103+
- name: golangci-lint
104+
owners: golangci
105+
title: Golangci-lint
106+
authors: golangci
107+
project_url: https://golangci-lint.run
108+
url_template: "https://github.com/golangci/golangci-lint/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
109+
icon_url: "https://cdn.rawgit.com/golangci/golangci-lint/master/assets/go.png"
110+
copyright: 2024 GolangCI
111+
license_url: https://github.com/golangci/golangci-lint/blob/master/LICENSE
112+
require_license_acceptance: false
113+
project_source_url: https://github.com/golangci/golangci-lint
114+
package_source_url: https://github.com/golangci/golangci-lint
115+
docs_url: https://golangci-lint.run
116+
bug_tracker_url: https://github.com/golangci/golangci-lint/issues
117+
tags: "go golang lint linter"
118+
summary: Fast linters Runner for Go
119+
description: |
120+
{{ .ProjectName }} installer package.
121+
Fast linters Runner for Go .
122+
release_notes: "https://github.com/golangci/golangci-lint/releases/tag/v{{ .Version }}"
123+
api_key: "{{ .Env.CHOCOLATEY_API_KEY }}"
124+
source_repo: "https://push.chocolatey.org/"
125+
skip_publish: false
126+
goamd64: v1
127+
102128
nfpms:
103129
-
104130
id: golangci-lint-nfpms

docs/src/docs/welcome/install.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Most installations of `golangci-lint` are performed for CI.
99
### GitHub Actions
1010

1111
We recommend using [our GitHub Action](https://github.com/golangci/golangci-lint-action) for running `golangci-lint` in CI for GitHub projects.
12-
It's [fast and uses smart caching](https://github.com/golangci/golangci-lint-action#performance) inside
12+
It's [fast and uses smart caching](https://github.com/golangci/golangci-lint-action#performance) inside,
1313
and it can be much faster than the simple binary installation.
1414

1515
Also, the action creates GitHub annotations for found issues: you don't need to dig into build log to see found by `golangci-lint` issues:
@@ -99,6 +99,14 @@ The macports installation mode is community driven, and not officially maintaine
9999
sudo port install golangci-lint
100100
```
101101

102+
### Windows
103+
104+
You can install a binary on Windows using [chocolatey](https://community.chocolatey.org/packages/golangci-lint):
105+
106+
```sh
107+
choco install golangci-lint
108+
```
109+
102110
### Install from Source
103111

104112
Note: such `go install`/`go get` installation aren't guaranteed to work. We recommend using binary installation.

0 commit comments

Comments
 (0)