Skip to content

Commit ef86d5b

Browse files
committed
更新依赖项,提升go版本
1 parent e1078de commit ef86d5b

File tree

8 files changed

+461
-13
lines changed

8 files changed

+461
-13
lines changed

.gitattributes

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
11
# Auto detect text files and perform LF normalization
2-
* text=auto
2+
* text=auto eol=lf
3+
4+
# These files are text and should be normalized (Convert CRLF to LF)
5+
*.go text diff=go
6+
*.yml text
7+
*.yaml text
8+
*.md text
9+
*.json text
10+
*.txt text
11+
*.sh text
12+
13+
# These files are binary and should be left untouched
14+
*.png binary
15+
*.jpg binary
16+
*.jpeg binary
17+
*.gif binary
18+
*.ico binary
19+
*.svg binary
20+
*.pdf binary
21+
*.zip binary
22+
*.tar.gz binary
23+
*.exe binary

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.24.6'
22+
23+
- name: Cache Go modules
24+
uses: actions/cache@v4
25+
with:
26+
path: ~/go/pkg/mod
27+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-
30+
31+
- name: Download dependencies
32+
run: go mod download
33+
34+
- name: Run tests
35+
run: go test -v ./...
36+
37+
- name: Build
38+
run: go build -v .
39+
40+
- name: Run go vet
41+
run: go vet ./...
42+
43+
- name: Run golint
44+
uses: golangci/golangci-lint-action@v6
45+
with:
46+
version: latest
47+
args: --timeout=5m

.github/workflows/release.yml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
name: Build and Release
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
include:
15+
# Linux
16+
- goos: linux
17+
goarch: amd64
18+
filename: webhookGo-linux-amd64
19+
- goos: linux
20+
goarch: arm64
21+
filename: webhookGo-linux-arm64
22+
- goos: linux
23+
goarch: 386
24+
filename: webhookGo-linux-386
25+
- goos: linux
26+
goarch: arm
27+
goarm: 7
28+
filename: webhookGo-linux-armv7
29+
# Windows
30+
- goos: windows
31+
goarch: amd64
32+
filename: webhookGo-windows-amd64.exe
33+
- goos: windows
34+
goarch: 386
35+
filename: webhookGo-windows-386.exe
36+
# macOS
37+
- goos: darwin
38+
goarch: amd64
39+
filename: webhookGo-darwin-amd64
40+
- goos: darwin
41+
goarch: arm64
42+
filename: webhookGo-darwin-arm64
43+
# FreeBSD
44+
- goos: freebsd
45+
goarch: amd64
46+
filename: webhookGo-freebsd-amd64
47+
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Set up Go
53+
uses: actions/setup-go@v5
54+
with:
55+
go-version: '1.24.6'
56+
57+
- name: Cache Go modules
58+
uses: actions/cache@v4
59+
with:
60+
path: ~/go/pkg/mod
61+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
62+
restore-keys: |
63+
${{ runner.os }}-go-
64+
65+
- name: Download dependencies
66+
run: go mod download
67+
68+
- name: Build
69+
env:
70+
GOOS: ${{ matrix.goos }}
71+
GOARCH: ${{ matrix.goarch }}
72+
GOARM: ${{ matrix.goarm }}
73+
CGO_ENABLED: 0
74+
run: |
75+
mkdir -p dist
76+
output_name="${{ matrix.filename }}"
77+
go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o "dist/${output_name}" .
78+
79+
- name: Create archive
80+
run: |
81+
cd dist
82+
if [ "${{ matrix.goos }}" = "windows" ]; then
83+
zip "../${{ matrix.filename }}.zip" *
84+
else
85+
tar -czf "../${{ matrix.filename }}.tar.gz" *
86+
fi
87+
88+
- name: Upload artifacts
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: ${{ matrix.filename }}
92+
path: |
93+
${{ matrix.filename }}.*
94+
retention-days: 30
95+
96+
release:
97+
name: Create Release
98+
needs: build
99+
runs-on: ubuntu-latest
100+
if: startsWith(github.ref, 'refs/tags/')
101+
102+
steps:
103+
- name: Checkout code
104+
uses: actions/checkout@v4
105+
106+
- name: Download all artifacts
107+
uses: actions/download-artifact@v4
108+
with:
109+
path: artifacts
110+
111+
- name: Prepare release assets
112+
run: |
113+
mkdir -p release-assets
114+
find artifacts -name "*.zip" -o -name "*.tar.gz" | while read file; do
115+
cp "$file" "release-assets/"
116+
done
117+
ls -la release-assets/
118+
119+
- name: Generate changelog
120+
id: changelog
121+
run: |
122+
# 获取上一个tag
123+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
124+
if [ -n "$PREVIOUS_TAG" ]; then
125+
echo "## 更新内容" > CHANGELOG.md
126+
echo "" >> CHANGELOG.md
127+
git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD >> CHANGELOG.md
128+
else
129+
echo "## 首次发布" > CHANGELOG.md
130+
echo "" >> CHANGELOG.md
131+
git log --pretty=format:"- %s (%h)" >> CHANGELOG.md
132+
fi
133+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
134+
cat CHANGELOG.md >> $GITHUB_OUTPUT
135+
echo "EOF" >> $GITHUB_OUTPUT
136+
137+
- name: Create Release
138+
uses: softprops/action-gh-release@v2
139+
with:
140+
files: release-assets/*
141+
body: |
142+
# 🎉 Release ${{ github.ref_name }}
143+
144+
${{ steps.changelog.outputs.changelog }}
145+
146+
## 📦 下载
147+
148+
选择适合您系统的二进制文件:
149+
150+
| 系统 | 架构 | 文件名 |
151+
|------|------|--------|
152+
| Linux | x86_64 | webhookGo-linux-amd64.tar.gz |
153+
| Linux | ARM64 | webhookGo-linux-arm64.tar.gz |
154+
| Linux | x86 (32位) | webhookGo-linux-386.tar.gz |
155+
| Linux | ARM v7 | webhookGo-linux-armv7.tar.gz |
156+
| Windows | x86_64 | webhookGo-windows-amd64.zip |
157+
| Windows | x86 (32位) | webhookGo-windows-386.zip |
158+
| macOS | x86_64 | webhookGo-darwin-amd64.tar.gz |
159+
| macOS | ARM64 (Apple Silicon) | webhookGo-darwin-arm64.tar.gz |
160+
| FreeBSD | x86_64 | webhookGo-freebsd-amd64.tar.gz |
161+
162+
## 🚀 使用方法
163+
164+
1. 下载适合您系统的压缩包
165+
2. 解压后获得可执行文件
166+
3. 根据需要配置 `defaultConfig.yml`
167+
4. 运行 `./webhookGo` (Linux/macOS) 或 `webhookGo.exe` (Windows)
168+
169+
---
170+
171+
**自动发布于** ${{ github.event.head_commit.timestamp }}
172+
draft: false
173+
prerelease: false
174+
generate_release_notes: false
175+
env:
176+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,22 @@ go.sum
2626
.vs
2727

2828
secrets.yml
29+
30+
# Build artifacts
31+
dist/
32+
build/
33+
webhookGo-*
34+
35+
# Temporary files
36+
*.tmp
37+
*.log
38+
CHANGELOG.md
39+
40+
# OS generated files
41+
.DS_Store
42+
.DS_Store?
43+
._*
44+
.Spotlight-V100
45+
.Trashes
46+
ehthumbs.db
47+
Thumbs.db

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@
22

33
目的:接受来自直播录制程序的Webhook请求,然后给用户设置的目标(现在是Bark和企业微信)推送消息。
44

5+
## 🚀 自动构建和发布
6+
7+
本项目使用 GitHub Actions 进行自动构建和发布。当您推送新的标签(如 `v1.0.0`)时,系统会自动:
8+
9+
1. 🏗️ 为所有主流平台和架构编译二进制文件
10+
2. 📦 创建压缩包并上传到 Releases
11+
3. 📝 自动生成发布说明和变更日志
12+
13+
### 支持的平台
14+
15+
| 系统 | 架构 | 文件名 |
16+
|------|------|--------|
17+
| Linux | x86_64 | webhookGo-linux-amd64.tar.gz |
18+
| Linux | ARM64 | webhookGo-linux-arm64.tar.gz |
19+
| Linux | x86 (32位) | webhookGo-linux-386.tar.gz |
20+
| Linux | ARM v7 | webhookGo-linux-armv7.tar.gz |
21+
| Windows | x86_64 | webhookGo-windows-amd64.zip |
22+
| Windows | x86 (32位) | webhookGo-windows-386.zip |
23+
| macOS | x86_64 | webhookGo-darwin-amd64.tar.gz |
24+
| macOS | ARM64 (Apple Silicon) | webhookGo-darwin-arm64.tar.gz |
25+
| FreeBSD | x86_64 | webhookGo-freebsd-amd64.tar.gz |
26+
27+
### 如何发布新版本
28+
29+
1. 确保代码已合并到 `master` 分支
30+
2. 创建并推送新标签:
31+
```bash
32+
git tag v1.0.0
33+
git push origin v1.0.0
34+
```
35+
3. GitHub Actions 会自动构建并发布新版本
36+
37+
---
38+
39+
## 💻 用法
40+
541
## 用法:
642
1.[release页面](https://github.com/Janet-Baker/webhookGo/releases)
743
找当前系统环境可以运行的软件包,下载下来。

go.mod

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,43 @@ module webhookGo
33
go 1.24.6
44

55
require (
6-
github.com/bytedance/sonic v1.14.0
7-
github.com/gin-gonic/gin v1.10.1
6+
github.com/bytedance/sonic v1.14.2
7+
github.com/gin-gonic/gin v1.11.0
88
github.com/orandin/lumberjackrus v1.0.1
99
github.com/sirupsen/logrus v1.9.3
1010
github.com/valyala/fastjson v1.6.4
11-
golang.org/x/sys v0.35.0
11+
golang.org/x/sys v0.38.0
1212
gopkg.in/yaml.v3 v3.0.1
1313
)
1414

1515
require (
16-
github.com/bytedance/sonic/loader v0.3.0 // indirect
16+
github.com/bytedance/gopkg v0.1.3 // indirect
17+
github.com/bytedance/sonic/loader v0.4.0 // indirect
1718
github.com/cloudwego/base64x v0.1.6 // indirect
18-
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
19+
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
1920
github.com/gin-contrib/sse v1.1.0 // indirect
2021
github.com/go-playground/locales v0.14.1 // indirect
2122
github.com/go-playground/universal-translator v0.18.1 // indirect
22-
github.com/go-playground/validator/v10 v10.27.0 // indirect
23+
github.com/go-playground/validator/v10 v10.28.0 // indirect
2324
github.com/goccy/go-json v0.10.5 // indirect
25+
github.com/goccy/go-yaml v1.18.0 // indirect
2426
github.com/json-iterator/go v1.1.12 // indirect
2527
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
28+
github.com/kr/text v0.2.0 // indirect
2629
github.com/leodido/go-urn v1.4.0 // indirect
2730
github.com/mattn/go-isatty v0.0.20 // indirect
2831
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2932
github.com/modern-go/reflect2 v1.0.2 // indirect
3033
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
34+
github.com/quic-go/qpack v0.6.0 // indirect
35+
github.com/quic-go/quic-go v0.57.1 // indirect
3136
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
32-
github.com/ugorji/go/codec v1.3.0 // indirect
33-
golang.org/x/arch v0.20.0 // indirect
34-
golang.org/x/crypto v0.41.0 // indirect
35-
golang.org/x/net v0.43.0 // indirect
36-
golang.org/x/text v0.28.0 // indirect
37-
google.golang.org/protobuf v1.36.7 // indirect
37+
github.com/ugorji/go/codec v1.3.1 // indirect
38+
go.uber.org/mock v0.6.0 // indirect
39+
golang.org/x/arch v0.23.0 // indirect
40+
golang.org/x/crypto v0.45.0 // indirect
41+
golang.org/x/net v0.47.0 // indirect
42+
golang.org/x/text v0.31.0 // indirect
43+
google.golang.org/protobuf v1.36.10 // indirect
3844
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
3945
)

0 commit comments

Comments
 (0)