Skip to content

Commit d83eeb4

Browse files
committed
using goreleaser
Signed-off-by: abzcoding <[email protected]>
1 parent cd16414 commit d83eeb4

File tree

2 files changed

+43
-8
lines changed

2 files changed

+43
-8
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@ on:
88

99
jobs:
1010
build:
11-
strategy:
12-
matrix:
13-
os: [ubuntu-latest, macos-latest, windows-latest]
14-
go-version: ['1.23']
15-
runs-on: ${{ matrix.os }}
11+
runs-on: ubuntu-latest
1612
steps:
1713
- uses: actions/checkout@v4
1814

1915
- name: Set up Go
2016
uses: actions/setup-go@v4
2117
with:
22-
go-version: ${{ matrix.go-version }}
18+
go-version: '1.23'
2319

2420
- name: Go Cache
2521
uses: actions/cache@v3
@@ -32,7 +28,6 @@ jobs:
3228
${{ runner.os }}-go-
3329
3430
- name: Security Scan
35-
if: matrix.os == 'ubuntu-latest'
3631
uses: securego/gosec@master
3732
with:
3833
args: ./...
@@ -46,6 +41,6 @@ jobs:
4641
- name: Upload Build Artifact
4742
uses: actions/upload-artifact@v3
4843
with:
49-
name: hget-${{ runner.os }}
44+
name: hget
5045
path: bin/hget
5146
if-no-files-found: error

.goreleaser.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
builds:
5+
- env:
6+
- CGO_ENABLED=0
7+
goos:
8+
- linux
9+
- windows
10+
- darwin
11+
goarch:
12+
- amd64
13+
- arm64
14+
ignore:
15+
- goos: windows
16+
goarch: arm64
17+
ldflags:
18+
- -s -w -X main.GitCommit={{.ShortCommit}}
19+
archives:
20+
- format: tar.gz
21+
name_template: >-
22+
{{ .ProjectName }}_
23+
{{- title .Os }}_
24+
{{- if eq .Arch "amd64" }}x86_64
25+
{{- else if eq .Arch "386" }}i386
26+
{{- else }}{{ .Arch }}{{ end }}
27+
{{- if .Arm }}v{{ .Arm }}{{ end }}
28+
format_overrides:
29+
- goos: windows
30+
format: zip
31+
checksum:
32+
name_template: 'checksums.txt'
33+
snapshot:
34+
name_template: "{{ incpatch .Version }}-next"
35+
changelog:
36+
sort: asc
37+
filters:
38+
exclude:
39+
- '^docs:'
40+
- '^test:'

0 commit comments

Comments
 (0)