Skip to content

Commit 1ff4ab5

Browse files
committed
feat: build binary files
1 parent d368cc2 commit 1ff4ab5

File tree

7 files changed

+73
-5
lines changed

7 files changed

+73
-5
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
-
16+
name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
-
21+
name: Set up Go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: 1.17
25+
-
26+
name: Run GoReleaser
27+
uses: goreleaser/goreleaser-action@v2
28+
with:
29+
distribution: goreleaser
30+
version: latest
31+
args: release --rm-dist
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
34+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ rabbitmq_exporter.exe
55
.tarballs/
66
coverage.out
77
debug.test
8-
vendor/
8+
vendor/
9+
dist/

.golangci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
linters-settings:
22
goimports:
3-
local-prefixes: github.com/kbudde/dsa
3+
local-prefixes: github.com/kbudde/rabbitmq_exporter
44
golint:
55
min-confidence: 0.8
66
gocyclo:

.goreleaser.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
builds:
5+
- env:
6+
- CGO_ENABLED=0
7+
binary: rabbitmq_exporter-{{.Version}}.{{.Target}}
8+
targets:
9+
- linux_amd64
10+
- linux_arm64
11+
- linux_arm_6
12+
- linux_arm_7
13+
- windows_amd64
14+
- darwin_amd64
15+
- darwin_arm64
16+
tags: netgo staticbuild
17+
ldflags:
18+
- -X main.Version={{.Version}}
19+
- -X main.Revision={{.ShortCommit}}
20+
- -X main.Branch={{.Branch}}
21+
- -X main.BuildDate={{.CommitDate}}
22+
checksum:
23+
name_template: 'checksums.txt'
24+
changelog:
25+
sort: asc
26+
filters:
27+
exclude:
28+
- '^docs:'
29+
- '^test:'
30+
release:
31+
discussion_category_name: Announcements

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/sirupsen/logrus v1.8.1
99
github.com/streadway/amqp v1.0.0
1010
github.com/tkanos/gonfig v0.0.0-20210106201359-53e13348de2f
11-
golang.org/x/sys v0.0.0-20211210111614-af8b64212486
11+
golang.org/x/sys v0.0.0-20211214170744-3b038e5940ed
1212
)
1313

1414
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
472472
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
473473
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
474474
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
475-
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 h1:5hpz5aRr+W1erYCL5JRhSUBJRph7l9XkNveoExlrKYk=
476-
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
475+
golang.org/x/sys v0.0.0-20211214170744-3b038e5940ed h1:d5glpD+GMms2DMbu1doSYibjbKasYNvnhq885nOnRz8=
476+
golang.org/x/sys v0.0.0-20211214170744-3b038e5940ed/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
477477
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
478478
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
479479
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

service_windows.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"golang.org/x/sys/windows/svc"
66
)
77

8+
const serviceName = "rabbitmq_exporter"
9+
810
func runService() chan bool {
911
stopCh := make(chan bool)
1012
isInteractive, err := svc.IsAnInteractiveSession()

0 commit comments

Comments
 (0)