Skip to content

Commit a2fac6d

Browse files
committed
ci: releaser and lint
1 parent 483cbe0 commit a2fac6d

File tree

4 files changed

+116
-28
lines changed

4 files changed

+116
-28
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
lint:
11+
name: Lint (Go ${{ matrix.go-version }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
go-version: [ '1.24', 'stable' ]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Go ${{ matrix.go-version }}
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: ${{ matrix.go-version }}
24+
check-latest: true
25+
26+
- name: Run golangci-lint (latest)
27+
uses: golangci/golangci-lint-action@v6
28+
with:
29+
version: latest
30+
args: --timeout=5m
31+
32+
build-test:
33+
name: Build & Test (Go ${{ matrix.go-version }})
34+
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
go-version: [ '1.24', 'stable' ]
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Set up Go ${{ matrix.go-version }}
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version: ${{ matrix.go-version }}
46+
check-latest: true
47+
cache: true
48+
49+
- name: Verify dependencies
50+
run: go mod tidy && git diff --exit-code go.mod go.sum
51+
52+
- name: Build
53+
run: make build
54+
55+
- name: Test
56+
run: make test

.github/workflows/go.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup Go 1.24 (or higher)
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.24'
22+
check-latest: true
23+
24+
- name: Run tests
25+
run: |
26+
go test ./...
27+
go mod tidy
28+
29+
- name: Release with GoReleaser
30+
uses: goreleaser/goreleaser-action@v6
31+
with:
32+
version: latest
33+
args: release --clean
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
builds:
3+
- main: cmd/berth/main.go
4+
binary: berth
5+
goos:
6+
- linux
7+
- darwin
8+
- windows
9+
goarch:
10+
- amd64
11+
- arm64
12+
13+
archives:
14+
- format: tar.gz
15+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
16+
17+
checksum:
18+
name_template: "checksums.txt"
19+
20+
release:
21+
github:
22+
owner: rluders
23+
name: berth
24+
draft: false
25+
prerelease: false

0 commit comments

Comments
 (0)