Skip to content

Commit 990a58e

Browse files
author
hopetree
committed
添加actions 自动打包
1 parent cc4bd05 commit 990a58e

3 files changed

Lines changed: 87 additions & 1 deletion

File tree

.github/workflows/go-releaser.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: go-releaser
2+
3+
permissions:
4+
contents: write
5+
id-token: write
6+
packages: write
7+
8+
on:
9+
push:
10+
tags: [ 'v*' ]
11+
12+
jobs:
13+
goreleaser:
14+
runs-on: ubuntu-latest
15+
env:
16+
flags: ''
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
- name: Set up Go
21+
uses: actions/setup-go@v3
22+
with:
23+
go-version: 1.21
24+
cache: true
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v5
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --clean ${{ env.flags }}
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
project_name: GoMonitor
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- binary: GoMonitor
9+
main: .
10+
env:
11+
- CGO_ENABLED=0
12+
goos:
13+
- linux
14+
goarch:
15+
- '386'
16+
- amd64
17+
- arm
18+
- arm64
19+
goarm:
20+
- '6'
21+
- '7'
22+
ignore:
23+
- goos: linux
24+
goarch: arm
25+
goarm: '7'
26+
27+
checksum:
28+
name_template: "checksums.txt"
29+
30+
archives:
31+
- name_template: >-
32+
{{ .ProjectName }}_
33+
{{- .Version }}_
34+
{{- if eq .Os "darwin" }}macos_
35+
{{- else }}{{ .Os }}_{{ end }}
36+
{{- if eq .Arch "amd64" }}x86_64
37+
{{- else if eq .Arch "386" }}i386
38+
{{- else if eq .Arch "arm64" }}aarch64
39+
{{- else if eq .Arch "arm" }}armv{{ .Arm }}
40+
{{- else }}{{ .Arch }}{{ end }}
41+
wrap_in_directory: true
42+
format_overrides:
43+
- goos: windows
44+
format: zip
45+
builds_info:
46+
group: root
47+
owner: root
48+
files:
49+
- README.md
50+
- LICENSE
51+
52+
53+
54+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
```shell
88
go mod tidy
9-
bo build
9+
go build
1010
```
1111

1212
## 命令使用

0 commit comments

Comments
 (0)