Skip to content

Commit 0e9c9db

Browse files
committed
ci: add goreleaser
1 parent f940948 commit 0e9c9db

File tree

6 files changed

+131
-1
lines changed

6 files changed

+131
-1
lines changed

.github/dependabot.yml

-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ updates:
44
directory: "/"
55
schedule:
66
interval: daily
7-
time: "02:00"
87
open-pull-requests-limit: 10

.github/workflows/build.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Go package
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
GOOS: ['linux']
13+
GOARCH: ['amd64', 'arm64', 'arm']
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-go@v4
17+
with:
18+
go-version: '>=1.21.0'
19+
- name: Build
20+
env:
21+
GOOS: ${{ matrix.GOOS }}
22+
GOARCH: ${{ matrix.GOARCH }}
23+
CGO_ENABLED: 0
24+
run: go build -trimpath

.github/workflows/lint.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Go Lint
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
name: Lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
- name: Set up Go
15+
uses: actions/setup-go@v4
16+
with:
17+
go-version: '>=1.21.0'
18+
- name: Run golangci-lint
19+
uses: golangci/golangci-lint-action@v3

.github/workflows/release.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
- name: Unshallow
15+
run: git fetch --prune --unshallow
16+
- name: Set up Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: '>=1.21.0'
20+
- name: Run GoReleaser
21+
uses: goreleaser/goreleaser-action@v4
22+
with:
23+
version: latest
24+
args: release --rm-dist
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Go Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
name: Test
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest]
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
- name: Set up Go
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: '>=1.21.0'
21+
id: go
22+
- name: Test
23+
run: go test -v ./...

.goreleaser.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
builds:
2+
- # First Build
3+
env:
4+
- CGO_ENABLED=0
5+
main: ./cmd/espotad
6+
ldflags: >-
7+
-s -w
8+
9+
# Set the binary output location to bin/ so archive will comply with Sensu Go Asset structure
10+
binary: bin/{{ .ProjectName }}
11+
goos:
12+
- linux
13+
goarch:
14+
- amd64
15+
- 386
16+
- arm
17+
- arm64
18+
goarm:
19+
- 5
20+
- 6
21+
- 7
22+
targets:
23+
- linux_386
24+
- linux_amd64
25+
- linux_arm_5
26+
- linux_arm_6
27+
- linux_arm_7
28+
- linux_arm64
29+
30+
checksum:
31+
name_template: "{{ .ProjectName }}_{{ .Version }}_sha512-checksums.txt"
32+
algorithm: sha512
33+
34+
archives:
35+
- id: tar
36+
format: tar.gz
37+
files:
38+
- LICENSE
39+
- README.md

0 commit comments

Comments
 (0)