Skip to content

Commit b732c4a

Browse files
committed
refactor: 重命名模块并更新依赖项
- 将模块名称从“github.com/orange-juzipi/cert-deploy”更改为“github.com/https-cert/deploy”。 - 将 `go.mod` 和 `go.sum` 中的依赖项更新为最新版本。 - 在“Makefile”中重构构建脚本,将二进制文件打包为“anssl”而不是“cert-deploy”。 - 更新了自述文件以反映新的二进制名称和安装说明。 - 调整了代码库中的命令引用以使用新的二进制名称“anssl”。
1 parent d020de0 commit b732c4a

File tree

27 files changed

+312
-191
lines changed

27 files changed

+312
-191
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ jobs:
3838
restore-keys: |
3939
${{ runner.os }}-go-
4040
41-
- name: Install UPX
42-
run: |
43-
sudo apt-get update
44-
sudo apt-get install -y upx
45-
4641
# 取得版本号:
4742
# - workflow_dispatch:若未填写则自动 vX.Y.(Z+1),并创建/推送该 tag
4843
# - push tag:使用该 tag
@@ -87,61 +82,67 @@ jobs:
8782
- name: Verify dependencies
8883
run: go mod verify
8984

85+
- name: Install UPX
86+
run: |
87+
sudo apt-get update
88+
sudo apt-get install -y upx
89+
9090
- name: Build for multiple platforms
9191
env:
9292
CGO_ENABLED: 0
9393
run: |
94-
mkdir -p release
95-
LDFLAGS="-s -w -X 'main.version=${{ steps.version.outputs.VERSION }}'"
94+
set -e
95+
mkdir -p release build
96+
# 将版本号写入 internal/config.Version,供更新逻辑使用
97+
LDFLAGS="-s -w -X 'github.com/https-cert/deploy/internal/config.Version=${{ steps.version.outputs.VERSION }}'"
9698
9799
echo "Build macOS..."
98-
GOOS=darwin GOARCH=amd64 go build -ldflags="${LDFLAGS}" -trimpath -o release/cert-deploy-mac main.go
99-
GOOS=darwin GOARCH=arm64 go build -ldflags="${LDFLAGS}" -trimpath -o release/cert-deploy-mac-arm64 main.go
100+
mkdir -p build/darwin-amd64 build/darwin-arm64
101+
GOOS=darwin GOARCH=amd64 go build -ldflags="${LDFLAGS}" -trimpath -o build/darwin-amd64/anssl main.go
102+
tar -C build/darwin-amd64 -czf release/anssl-darwin-amd64.tar.gz anssl
103+
GOOS=darwin GOARCH=arm64 go build -ldflags="${LDFLAGS}" -trimpath -o build/darwin-arm64/anssl main.go
104+
tar -C build/darwin-arm64 -czf release/anssl-darwin-arm64.tar.gz anssl
100105
101106
echo "Build Linux..."
102-
GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -trimpath -o release/cert-deploy-linux main.go
103-
GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -trimpath -o release/cert-deploy-linux-arm64 main.go
107+
mkdir -p build/linux-amd64 build/linux-arm64
108+
GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -trimpath -o build/linux-amd64/anssl main.go
109+
echo "UPX compress linux-amd64..."
110+
upx --best build/linux-amd64/anssl || echo "⚠️ ignore UPX failure: linux-amd64"
111+
tar -C build/linux-amd64 -czf release/anssl-linux-amd64.tar.gz anssl
112+
GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -trimpath -o build/linux-arm64/anssl main.go
113+
echo "UPX compress linux-arm64..."
114+
upx --best build/linux-arm64/anssl || echo "⚠️ ignore UPX failure: linux-arm64"
115+
tar -C build/linux-arm64 -czf release/anssl-linux-arm64.tar.gz anssl
104116
105117
echo "Build Windows..."
106-
GOOS=windows GOARCH=amd64 go build -ldflags="${LDFLAGS}" -trimpath -o release/cert-deploy-windows.exe main.go
107-
GOOS=windows GOARCH=arm64 go build -ldflags="${LDFLAGS}" -trimpath -o release/cert-deploy-windows-arm64.exe main.go
118+
mkdir -p build/windows-amd64 build/windows-arm64
119+
GOOS=windows GOARCH=amd64 go build -ldflags="${LDFLAGS}" -trimpath -o build/windows-amd64/anssl.exe main.go
120+
(cd build/windows-amd64 && zip -q ../../release/anssl-windows-amd64.zip anssl.exe)
121+
GOOS=windows GOARCH=arm64 go build -ldflags="${LDFLAGS}" -trimpath -o build/windows-arm64/anssl.exe main.go
122+
(cd build/windows-arm64 && zip -q ../../release/anssl-windows-arm64.zip anssl.exe)
108123
109124
- name: Show build info
110125
run: |
111126
echo "=== Build Info ==="
112127
echo "Version: ${{ steps.version.outputs.VERSION }}"
113128
echo "Go: $(go version)"
114-
echo "UPX: $(upx --version)"
115129
echo "Files:"
116130
ls -lh release/
117131
118-
- name: Compress Linux binaries with UPX
119-
run: |
120-
echo "UPX Linux binaries..."
121-
for f in release/cert-deploy-linux release/cert-deploy-linux-arm64; do
122-
if [ -f "$f" ]; then
123-
echo "UPX -> $f"
124-
upx --best "$f" || echo "⚠️ ignore UPX failure: $f"
125-
fi
126-
done
127-
echo "Done."
128-
ls -lh release/cert-deploy-linux*
129-
130-
# 不再打包 zip/tar.gz;直接上传可执行文件
131132
- name: Generate checksums
132133
run: |
133134
cd release
134-
sha256sum cert-deploy-* > checksums.txt
135+
sha256sum anssl-* > checksums.txt
135136
echo "checksums generated:"
136137
cat checksums.txt
137138
138139
- name: Create all-platforms archive
139140
run: |
140141
cd release
141142
echo "Creating all-platforms archive..."
142-
tar -czf cert-deploy-all-platforms.tar.gz cert-deploy-*
143+
tar -czf anssl-all-platforms.tar.gz anssl-*
143144
echo "Archive created:"
144-
ls -lh cert-deploy-all-platforms.tar.gz
145+
ls -lh anssl-all-platforms.tar.gz
145146
146147
# 生成详细的更新日志
147148
- name: Generate changelog
@@ -202,13 +203,13 @@ jobs:
202203
with:
203204
body: ${{ steps.changelog.outputs.CHANGELOG_CONTENT }}
204205
files: |
205-
release/cert-deploy-mac
206-
release/cert-deploy-mac-arm64
207-
release/cert-deploy-linux
208-
release/cert-deploy-linux-arm64
209-
release/cert-deploy-windows.exe
210-
release/cert-deploy-windows-arm64.exe
211-
release/cert-deploy-all-platforms.tar.gz
206+
release/anssl-darwin-amd64.tar.gz
207+
release/anssl-darwin-arm64.tar.gz
208+
release/anssl-linux-amd64.tar.gz
209+
release/anssl-linux-arm64.tar.gz
210+
release/anssl-windows-amd64.zip
211+
release/anssl-windows-arm64.zip
212+
release/anssl-all-platforms.tar.gz
212213
release/checksums.txt
213214
release/CHANGELOG.md
214215
draft: false
@@ -222,13 +223,13 @@ jobs:
222223
name: Release ${{ steps.version.outputs.VERSION }}
223224
body: ${{ steps.changelog.outputs.CHANGELOG_CONTENT }}
224225
files: |
225-
release/cert-deploy-mac
226-
release/cert-deploy-mac-arm64
227-
release/cert-deploy-linux
228-
release/cert-deploy-linux-arm64
229-
release/cert-deploy-windows.exe
230-
release/cert-deploy-windows-arm64.exe
231-
release/cert-deploy-all-platforms.tar.gz
226+
release/anssl-darwin-amd64.tar.gz
227+
release/anssl-darwin-arm64.tar.gz
228+
release/anssl-linux-amd64.tar.gz
229+
release/anssl-linux-arm64.tar.gz
230+
release/anssl-windows-amd64.zip
231+
release/anssl-windows-arm64.zip
232+
release/anssl-all-platforms.tar.gz
232233
release/checksums.txt
233234
release/CHANGELOG.md
234235
draft: false

Makefile

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,51 @@ all: proto build
77
build: build-mac build-linux build-windows
88
@echo "所有平台构建完成"
99

10-
# 构建 Mac 版本
10+
# 构建 Mac 版本(打包为 tar.gz,内部二进制名为 anssl)
1111
build-mac:
1212
@echo "构建 Mac 版本..."
13-
@mkdir -p bin
14-
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/cert-deploy-mac main.go
15-
@GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/cert-deploy-mac-arm64 main.go
13+
@mkdir -p bin bin/darwin-amd64 bin/darwin-arm64
14+
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/darwin-amd64/anssl main.go
15+
@tar -C bin/darwin-amd64 -czf bin/anssl-darwin-amd64.tar.gz anssl
16+
@GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/darwin-arm64/anssl main.go
17+
@tar -C bin/darwin-arm64 -czf bin/anssl-darwin-arm64.tar.gz anssl
18+
@rm -rf bin/darwin-amd64 bin/darwin-arm64
1619
@echo "Mac 版本构建完成"
1720

18-
# 构建 Linux 版本
21+
# 构建 Linux 版本(打包为 tar.gz,内部二进制名为 anssl)
1922
build-linux:
2023
@echo "构建 Linux 版本..."
21-
@mkdir -p bin
22-
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/cert-deploy-linux main.go
23-
@GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/cert-deploy-linux-arm64 main.go
24+
@mkdir -p bin bin/linux-amd64 bin/linux-arm64
25+
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/linux-amd64/anssl main.go
26+
@echo "尝试使用 UPX 压缩 linux-amd64 二进制..."
27+
@if command -v upx >/dev/null 2>&1; then \
28+
upx --best bin/linux-amd64/anssl || echo "UPX 压缩失败(linux-amd64),已忽略"; \
29+
else \
30+
echo "UPX 未安装,跳过 linux-amd64 压缩"; \
31+
fi
32+
@tar -C bin/linux-amd64 -czf bin/anssl-linux-amd64.tar.gz anssl
33+
@GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/linux-arm64/anssl main.go
34+
@echo "尝试使用 UPX 压缩 linux-arm64 二进制..."
35+
@if command -v upx >/dev/null 2>&1; then \
36+
upx --best bin/linux-arm64/anssl || echo "UPX 压缩失败(linux-arm64),已忽略"; \
37+
else \
38+
echo "UPX 未安装,跳过 linux-arm64 压缩"; \
39+
fi
40+
@tar -C bin/linux-arm64 -czf bin/anssl-linux-arm64.tar.gz anssl
41+
@rm -rf bin/linux-amd64 bin/linux-arm64
2442
@echo "Linux 版本构建完成"
2543

26-
# 构建 Windows 版本
44+
# 构建 Windows 版本(打包为 zip,内部二进制名为 anssl.exe)
2745
build-windows:
2846
@echo "构建 Windows 版本..."
29-
@mkdir -p bin
30-
@GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/cert-deploy-windows.exe main.go
31-
@GOOS=windows GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/cert-deploy-windows-arm64.exe main.go
47+
@mkdir -p bin bin/windows-amd64 bin/windows-arm64
48+
@GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/windows-amd64/anssl.exe main.go
49+
@cd bin/windows-amd64 && zip -q ../../bin/anssl-windows-amd64.zip anssl.exe
50+
@GOOS=windows GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/windows-arm64/anssl.exe main.go
51+
@cd bin/windows-arm64 && zip -q ../../bin/anssl-windows-arm64.zip anssl.exe
52+
@rm -rf bin/windows-amd64 bin/windows-arm64
3253
@echo "Windows 版本构建完成"
3354

34-
# 压缩二进制文件(需要安装 UPX)
35-
compress:
36-
@echo "压缩二进制文件..."
37-
@if command -v upx >/dev/null 2>&1; then \
38-
upx --best bin/cert-deploy-linux*; \
39-
echo "压缩完成"; \
40-
else \
41-
echo "UPX 未安装,跳过压缩步骤"; \
42-
echo "安装 UPX: brew install upx (macOS) 或 apt install upx (Ubuntu)"; \
43-
fi
44-
45-
# 构建并压缩所有版本
46-
build-compress: build compress
47-
@echo "构建和压缩完成"
55+
# 兼容旧的 build-compress 目标(现在等价于 build)
56+
build-compress: build
57+
@echo "构建完成(输出为压缩包,内部应用名为 anssl)"

0 commit comments

Comments
 (0)