Skip to content

Commit 6e581ac

Browse files
authored
ci: update configs (#187)
1 parent 8c10b87 commit 6e581ac

File tree

5 files changed

+93
-68
lines changed

5 files changed

+93
-68
lines changed

.github/dependabot.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ updates:
88
labels:
99
- "dependencies"
1010
commit-message:
11-
prefix: "feat"
11+
prefix: "chore"
1212
include: "scope"
1313
- package-ecosystem: "github-actions"
1414
directory: "/"
@@ -28,5 +28,5 @@ updates:
2828
labels:
2929
- "dependencies"
3030
commit-message:
31-
prefix: "feat"
31+
prefix: "chore"
3232
include: "scope"

.github/workflows/build.yml

+26-21
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,44 @@ on:
44
push:
55
branches:
66
- "main"
7-
tags:
8-
- "v*"
97
pull_request:
108

119
jobs:
12-
windowsTest:
13-
runs-on: windows-latest
10+
build:
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
os: [ubuntu-latest, windows-latest]
15+
runs-on: ${{ matrix.os }}
1416
steps:
1517
- uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 0
1818
- uses: actions/setup-go@v5
1919
with:
2020
go-version: "stable"
21-
- run: go test -v -race -count=1 ./...
22-
goreleaser:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- uses: actions/checkout@v4
26-
with:
27-
fetch-depth: 0
28-
- uses: actions/setup-go@v5
21+
- uses: goreleaser/goreleaser-action@v6
2922
with:
30-
go-version: "stable"
31-
- run: make ci
23+
install-only: true
24+
- run: goreleaser build --snapshot --clean --snapshot
25+
- run: go test -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.out ./... -timeout=5m
3226
- uses: codecov/codecov-action@v5
3327
with:
3428
token: ${{ secrets.CODECOV_TOKEN }}
3529
file: ./coverage.out
36-
- uses: goreleaser/goreleaser-action@v6
37-
if: success() && startsWith(github.ref, 'refs/tags/')
30+
dependabot:
31+
needs: [build]
32+
runs-on: ubuntu-latest
33+
permissions:
34+
pull-requests: write
35+
contents: write
36+
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
37+
steps:
38+
- id: metadata
39+
uses: dependabot/fetch-metadata@v2
3840
with:
39-
version: latest
40-
args: release --clean
41+
github-token: "${{ secrets.GITHUB_TOKEN }}"
42+
- run: |
43+
gh pr review --approve "$PR_URL"
44+
gh pr merge --squash --auto "$PR_URL"
4145
env:
42-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
46+
PR_URL: ${{github.event.pull_request.html_url}}
47+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/release.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: releaese
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version: "stable"
18+
- uses: goreleaser/goreleaser-action@v6
19+
with:
20+
version: latest
21+
args: release --clean
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

.goreleaser.yml

+41-40
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
1+
version: 2
2+
13
before:
24
hooks:
3-
- go mod tidy
5+
- go mod tidy
46

57
gomod:
68
proxy: true
79

810
builds:
9-
- main: ./cmd/chglog
10-
env:
11-
- CGO_ENABLED=0
12-
goos:
13-
- linux
14-
- darwin
15-
- windows
16-
goarch:
17-
- amd64
18-
- arm64
19-
mod_timestamp: '{{ .CommitTimestamp }}'
20-
flags:
21-
- -trimpath
22-
ldflags:
23-
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser
11+
- main: ./cmd/chglog
12+
env:
13+
- CGO_ENABLED=0
14+
goos:
15+
- linux
16+
- darwin
17+
- windows
18+
goarch:
19+
- amd64
20+
- arm64
21+
mod_timestamp: "{{ .CommitTimestamp }}"
22+
flags:
23+
- -trimpath
24+
ldflags:
25+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser
2426

2527
changelog:
2628
sort: asc
2729
use: github
2830
filters:
2931
exclude:
30-
- '^test:'
31-
- '^chore'
32-
- 'merge conflict'
33-
- Merge pull request
34-
- Merge remote-tracking branch
35-
- Merge branch
36-
- go mod tidy
32+
- "^test:"
33+
- "^chore"
34+
- "merge conflict"
35+
- Merge pull request
36+
- Merge remote-tracking branch
37+
- Merge branch
38+
- go mod tidy
3739
groups:
3840
- title: Dependency updates
3941
regexp: "^.*feat\\(deps\\)*:+.*$"
4042
order: 300
41-
- title: 'New Features'
43+
- title: "New Features"
4244
regexp: "^.*feat[(\\w)]*:+.*$"
4345
order: 100
44-
- title: 'Bug fixes'
46+
- title: "Bug fixes"
4547
regexp: "^.*fix[(\\w)]*:+.*$"
4648
order: 200
47-
- title: 'Documentation updates'
49+
- title: "Documentation updates"
4850
regexp: "^.*docs[(\\w)]*:+.*$"
4951
order: 400
5052
- title: Other work
@@ -59,33 +61,32 @@ archives:
5961
{{- else }}{{ .Arch }}{{ end }}
6062
{{- if .Arm }}v{{ .Arm }}{{ end }}
6163
brews:
62-
- tap:
64+
- repository:
6365
owner: goreleaser
6466
name: homebrew-tap
65-
folder: Formula
66-
homepage: https://github.com/goreleaser/chglog
67+
directory: Formula
68+
homepage: https://github.com/goreleaser/chglog
6769
description: chglog is a changelog management library and tool
6870
test: |
6971
system "#{bin}/chglog version"
7072
nfpms:
71-
- file_name_template: '{{ .ProjectName }}_{{ .Arch }}'
72-
homepage: https://github.com/goreleaser/chglog
73+
- file_name_template: "{{ .ProjectName }}_{{ .Arch }}"
74+
homepage: https://github.com/goreleaser/chglog
7375
description: chglog is a changelog management library and tool
7476
maintainer: Dj Gilcrease <d.gilcrease@f5.com>
7577
license: MIT
7678
vendor: GoReleaser
7779
formats:
7880
- deb
7981
- rpm
80-
scoop:
81-
bucket:
82-
owner: goreleaser
83-
name: scoop-bucket
84-
homepage: https://goreleaser.com
85-
folder: bucket
86-
description: Deliver Go binaries as fast and easily as possible
87-
license: MIT
88-
82+
scoops:
83+
- repository:
84+
owner: goreleaser
85+
name: scoop-bucket
86+
homepage: https://goreleaser.com
87+
directory: bucket
88+
description: Deliver Go binaries as fast and easily as possible
89+
license: MIT
8990

9091
release:
9192
footer: |

Makefile

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ SOURCE_FILES?=./...
22
TEST_PATTERN?=.
33
TEST_OPTIONS?=
44
TEST_TIMEOUT?=5m
5-
SEMVER?=0.0.0-$(shell whoami)
6-
CI_COMMIT_SHORT_SHA?=$(shell git log --pretty=format:'%h' -n 1)
75

86
test:
97
go test $(TEST_OPTIONS) -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.out $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=$(TEST_TIMEOUT)
@@ -22,9 +20,7 @@ ci: build test
2220
.PHONY: ci
2321

2422
build:
25-
go build -tags 'release netgo osusergo' \
26-
-ldflags '$(linker_flags) -s -w -extldflags "-fno-PIC -static" -X main.pkgName=chglog -X main.version=$(SEMVER) -X main.commit=$(CI_COMMIT_SHORT_SHA)' \
27-
-o chglog ./cmd/chglog/...
23+
goreleaser build --clean --snapshot --single-target -o chglog
2824
.PHONY: build
2925

3026
.DEFAULT_GOAL := build

0 commit comments

Comments
 (0)