Skip to content

Commit

Permalink
feat: build binary files
Browse files Browse the repository at this point in the history
  • Loading branch information
kbudde committed Dec 14, 2021
1 parent d368cc2 commit 1ff4ab5
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 5 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: goreleaser

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ rabbitmq_exporter.exe
.tarballs/
coverage.out
debug.test
vendor/
vendor/
dist/
2 changes: 1 addition & 1 deletion .golangci
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
linters-settings:
goimports:
local-prefixes: github.com/kbudde/dsa
local-prefixes: github.com/kbudde/rabbitmq_exporter
golint:
min-confidence: 0.8
gocyclo:
Expand Down
31 changes: 31 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
binary: rabbitmq_exporter-{{.Version}}.{{.Target}}
targets:
- linux_amd64
- linux_arm64
- linux_arm_6
- linux_arm_7
- windows_amd64
- darwin_amd64
- darwin_arm64
tags: netgo staticbuild
ldflags:
- -X main.Version={{.Version}}
- -X main.Revision={{.ShortCommit}}
- -X main.Branch={{.Branch}}
- -X main.BuildDate={{.CommitDate}}
checksum:
name_template: 'checksums.txt'
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
release:
discussion_category_name: Announcements
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/sirupsen/logrus v1.8.1
github.com/streadway/amqp v1.0.0
github.com/tkanos/gonfig v0.0.0-20210106201359-53e13348de2f
golang.org/x/sys v0.0.0-20211210111614-af8b64212486
golang.org/x/sys v0.0.0-20211214170744-3b038e5940ed
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 h1:5hpz5aRr+W1erYCL5JRhSUBJRph7l9XkNveoExlrKYk=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211214170744-3b038e5940ed h1:d5glpD+GMms2DMbu1doSYibjbKasYNvnhq885nOnRz8=
golang.org/x/sys v0.0.0-20211214170744-3b038e5940ed/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
2 changes: 2 additions & 0 deletions service_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"golang.org/x/sys/windows/svc"
)

const serviceName = "rabbitmq_exporter"

func runService() chan bool {
stopCh := make(chan bool)
isInteractive, err := svc.IsAnInteractiveSession()
Expand Down

0 comments on commit 1ff4ab5

Please sign in to comment.