Skip to content

Commit c3d236e

Browse files
committed
修复:CI 工作流中 gosec 安装问题
- 修复 gosec 下载链接格式错误 - 使用正确的版本号获取和下载方式 - 确保二进制文件权限正确设置
1 parent 81fce1c commit c3d236e

File tree

2 files changed

+114
-31
lines changed

2 files changed

+114
-31
lines changed

.github/workflows/build.yml

Lines changed: 106 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -283,47 +283,126 @@ jobs:
283283
284284
- name: Generate release notes
285285
run: |
286+
# 获取当前和前一个标签
287+
CURRENT_TAG="${{ github.ref_name }}"
288+
PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -A1 "$CURRENT_TAG" | tail -1)
289+
290+
# 如果没有前一个标签,使用第一个提交
291+
if [ -z "$PREVIOUS_TAG" ] || [ "$PREVIOUS_TAG" = "$CURRENT_TAG" ]; then
292+
PREVIOUS_TAG=$(git rev-list --max-parents=0 HEAD)
293+
fi
294+
295+
echo "生成从 $PREVIOUS_TAG 到 $CURRENT_TAG 的变更日志"
296+
297+
# 获取提交信息
298+
COMMITS=$(git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..$CURRENT_TAG 2>/dev/null || git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD)
299+
300+
# 获取文件变更统计
301+
STATS=$(git diff --stat $PREVIOUS_TAG..$CURRENT_TAG 2>/dev/null || git diff --stat $PREVIOUS_TAG..HEAD || echo "首次发布")
302+
286303
cat > release-notes.md << EOF
287-
## FileCodeBox ${{ github.ref_name }}
304+
## FileCodeBox $CURRENT_TAG
305+
306+
### 📝 本次更新
307+
308+
$COMMITS
309+
310+
### � 变更统计
311+
\`\`\`
312+
$STATS
313+
\`\`\`
314+
315+
### �🚀 功能特性
316+
- ✅ 多平台可执行文件支持 (Linux, macOS, Windows)
317+
- ✅ 支持 AMD64 和 ARM64 架构
318+
- ✅ Docker 镜像自动构建和发布
319+
- ✅ 文件上传下载服务
320+
- ✅ 用户认证系统
321+
- ✅ 管理员控制面板
322+
- ✅ 多种存储后端支持 (本地/S3/WebDAV)
288323
289-
### 🚀 新特性
290-
- 多平台可执行文件支持 (Linux, macOS, Windows)
291-
- 支持 AMD64 和 ARM64 架构
292-
- Docker 镜像自动构建
324+
### 📦 安装方式
293325
294-
### 📦 下载说明
326+
#### 方式一:直接下载可执行文件
295327
296-
**可执行文件:**
297-
- \`filecodebox-linux-amd64.tar.gz\` - Linux x64
298-
- \`filecodebox-linux-arm64.tar.gz\` - Linux ARM64
299-
- \`filecodebox-darwin-amd64.tar.gz\` - macOS Intel
300-
- \`filecodebox-darwin-arm64.tar.gz\` - macOS Apple Silicon
301-
- \`filecodebox-windows-amd64.zip\` - Windows x64
302-
- \`filecodebox-windows-arm64.zip\` - Windows ARM64
328+
选择对应平台的文件下载:
329+
- 🐧 **Linux x64**: \`filecodebox-linux-amd64.tar.gz\`
330+
- 🐧 **Linux ARM64**: \`filecodebox-linux-arm64.tar.gz\`
331+
- 🍎 **macOS Intel**: \`filecodebox-darwin-amd64.tar.gz\`
332+
- 🍎 **macOS Apple Silicon**: \`filecodebox-darwin-arm64.tar.gz\`
333+
- 🪟 **Windows x64**: \`filecodebox-windows-amd64.zip\`
334+
- 🪟 **Windows ARM64**: \`filecodebox-windows-arm64.zip\`
335+
336+
#### 方式二:Docker 部署
303337
304-
**Docker 镜像:**
305338
\`\`\`bash
306-
docker pull ghcr.io/zy84338719/filecodebox:${{ github.ref_name }}
307-
# 或者最新版本
308-
docker pull ghcr.io/zy84338719/filecodebox:latest
339+
# 拉取镜像
340+
docker pull ghcr.io/zy84338719/filecodebox:$CURRENT_TAG
341+
342+
# 运行容器
343+
docker run -d \\
344+
--name filecodebox \\
345+
-p 12345:12345 \\
346+
-v ./data:/app/data \\
347+
ghcr.io/zy84338719/filecodebox:$CURRENT_TAG
348+
\`\`\`
349+
350+
#### 方式三:Docker Compose
351+
352+
\`\`\`yaml
353+
version: '3.8'
354+
services:
355+
filecodebox:
356+
image: ghcr.io/zy84338719/filecodebox:$CURRENT_TAG
357+
ports:
358+
- "12345:12345"
359+
volumes:
360+
- ./data:/app/data
361+
restart: unless-stopped
309362
\`\`\`
310363
311364
### 🔧 快速开始
312365
313-
1. 下载对应平台的可执行文件
314-
2. 解压后运行 filecodebox
315-
3. 访问 http://localhost:12345
316-
4. 管理员界面: http://localhost:12345/admin (默认密码: admin)
366+
1. **下载并启动服务**
367+
- 下载对应平台的文件并解压
368+
- 运行 \`./filecodebox\` (Linux/macOS) 或 \`filecodebox.exe\` (Windows)
369+
370+
2. **访问服务**
371+
- 用户界面: http://localhost:12345
372+
- 管理员界面: http://localhost:12345/admin
373+
- 默认管理员密码: \`FileCodeBox2025\`
374+
375+
3. **基本配置**
376+
- 修改管理员密码
377+
- 配置存储后端
378+
- 设置用户系统开关
317379
318380
### 📋 系统要求
319-
- 无特殊依赖
320-
- 支持所有主流操作系统
321-
- 最小内存: 64MB
322-
- 推荐内存: 256MB+
381+
382+
- **操作系统**: Linux, macOS, Windows
383+
- **架构**: AMD64 或 ARM64
384+
- **内存**: 最小 64MB,推荐 256MB+
385+
- **存储**: 根据使用量而定
386+
- **网络**: HTTP/HTTPS 端口访问
387+
388+
### 🔒 安全说明
389+
390+
- 首次启动请立即修改默认管理员密码
391+
- 生产环境建议配置 HTTPS
392+
- 定期备份数据目录
393+
394+
### 🆘 问题反馈
395+
396+
如遇到问题,请访问:
397+
- **GitHub Issues**: https://github.com/${{ github.repository }}/issues
398+
- **文档**: https://github.com/${{ github.repository }}#readme
323399
324400
---
325401
326-
**完整更新日志和文档:** https://github.com/${{ github.repository }}
402+
**构建信息**
403+
- 构建时间: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
404+
- Git 提交: ${{ github.sha }}
405+
- Go 版本: $(go version | cut -d' ' -f3)
327406
EOF
328407
329408
- name: Create Release
@@ -334,6 +413,6 @@ jobs:
334413
body_path: release-notes.md
335414
draft: false
336415
prerelease: ${{ contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}
337-
generate_release_notes: true
416+
generate_release_notes: false
338417
env:
339418
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,15 @@ jobs:
161161

162162
- name: Run Gosec Security Scanner
163163
run: |
164-
# 下载并安装 gosec 二进制文件
165-
GOSEC_VERSION=$(curl -s "https://api.github.com/repos/securecodewarrior/gosec/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
166-
wget "https://github.com/securecodewarrior/gosec/releases/download/${GOSEC_VERSION}/gosec_${GOSEC_VERSION#v}_linux_amd64.tar.gz"
167-
tar -xzf "gosec_${GOSEC_VERSION#v}_linux_amd64.tar.gz"
164+
# 获取最新版本号
165+
VERSION=$(curl -s https://api.github.com/repos/securecodewarrior/gosec/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
166+
echo "安装 gosec 版本: $VERSION"
167+
168+
# 下载二进制文件
169+
curl -sfL "https://github.com/securecodewarrior/gosec/releases/download/${VERSION}/gosec_${VERSION#v}_linux_amd64.tar.gz" | tar xz
168170
chmod +x gosec
171+
172+
# 运行扫描
169173
./gosec -fmt json -out gosec-report.json ./...
170174
171175
- name: Upload Gosec report

0 commit comments

Comments
 (0)