Skip to content

Commit 58dcbc0

Browse files
author
githubnull
committed
feat: 添加GitHub Actions自动发布功能和表格编辑功能修复 - 包含完整的CI/CD流程、跨平台发布脚本、详细文档系统和UI功能优化
1 parent 3d90b49 commit 58dcbc0

File tree

18 files changed

+2892
-31
lines changed

18 files changed

+2892
-31
lines changed

.github/workflows/release.yml

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
name: 自动发布版本
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # 当推送以v开头的tag时触发,如v1.0.0
7+
8+
jobs:
9+
release:
10+
name: 构建并发布版本
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write # 需要写权限来创建release
14+
15+
steps:
16+
- name: 检出代码
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0 # 获取完整历史记录用于生成变更日志
20+
21+
- name: 设置Java环境
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '17'
25+
distribution: 'temurin'
26+
27+
- name: 缓存Maven依赖
28+
uses: actions/cache@v3
29+
with:
30+
path: ~/.m2
31+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32+
restore-keys: ${{ runner.os }}-m2
33+
34+
- name: 提取版本信息
35+
id: version
36+
run: |
37+
# 从tag中提取版本号(去除v前缀)
38+
VERSION=${GITHUB_REF#refs/tags/v}
39+
echo "version=$VERSION" >> $GITHUB_OUTPUT
40+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
41+
echo "提取的版本号: $VERSION"
42+
43+
- name: 验证版本号格式
44+
run: |
45+
if [[ ! "${{ steps.version.outputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
46+
echo "错误: 版本号格式无效。应该是x.y.z格式,如1.0.0"
47+
exit 1
48+
fi
49+
echo "版本号格式验证通过: ${{ steps.version.outputs.version }}"
50+
51+
- name: 更新pom.xml版本号
52+
run: |
53+
# 更新Maven项目版本号
54+
mvn versions:set -DnewVersion=${{ steps.version.outputs.version }} -DgenerateBackupPoms=false
55+
echo "已更新pom.xml版本号为: ${{ steps.version.outputs.version }}"
56+
57+
- name: 编译和打包
58+
run: |
59+
echo "开始编译项目..."
60+
mvn clean compile
61+
echo "开始打包项目..."
62+
mvn package -DskipTests
63+
64+
- name: 验证构建产物
65+
run: |
66+
JAR_FILE="target/showMeUCode-${{ steps.version.outputs.version }}.jar"
67+
if [ ! -f "$JAR_FILE" ]; then
68+
echo "错误: JAR文件不存在: $JAR_FILE"
69+
exit 1
70+
fi
71+
72+
# 显示文件信息
73+
ls -la target/*.jar
74+
echo "JAR文件大小: $(du -h $JAR_FILE | cut -f1)"
75+
76+
- name: 生成变更日志
77+
id: changelog
78+
run: |
79+
echo "正在生成变更日志..."
80+
81+
# 获取上一个tag
82+
PREVIOUS_TAG=$(git tag --sort=-version:refname | head -2 | tail -1)
83+
if [ -z "$PREVIOUS_TAG" ]; then
84+
echo "这是第一个版本,使用所有提交记录"
85+
PREVIOUS_TAG=$(git rev-list --max-parents=0 HEAD)
86+
fi
87+
88+
echo "从 $PREVIOUS_TAG 到 ${{ steps.version.outputs.tag }} 的变更:"
89+
90+
# 生成变更日志
91+
CHANGELOG=$(cat << 'EOF'
92+
## 🚀 版本 ${{ steps.version.outputs.version }} 发布说明
93+
94+
### 📦 构建信息
95+
- **版本号**: ${{ steps.version.outputs.version }}
96+
- **发布日期**: $(date '+%Y年%m月%d日')
97+
- **Java版本**: 17
98+
- **构建工具**: Maven
99+
100+
### 🔄 主要变更
101+
EOF
102+
)
103+
104+
# 添加提交记录
105+
git log --pretty=format:"- %s (%h)" ${PREVIOUS_TAG}..${{ steps.version.outputs.tag }} >> changelog_temp.md
106+
107+
# 检查是否有docs/release-notes.md文件
108+
if [ -f "docs/release-notes.md" ]; then
109+
echo "" >> changelog_temp.md
110+
echo "### 📋 详细发布说明" >> changelog_temp.md
111+
echo "请查看 [完整发布说明](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/docs/release-notes.md)" >> changelog_temp.md
112+
fi
113+
114+
# 添加下载和使用说明
115+
cat << 'EOF' >> changelog_temp.md
116+
117+
### 📥 下载和安装
118+
119+
1. **下载JAR文件**: 点击下方 Assets 中的 `showMeUCode-${{ steps.version.outputs.version }}.jar`
120+
2. **安装到Burp Suite**:
121+
- 打开Burp Suite
122+
- 进入 Extensions 标签页
123+
- 点击 Add 按钮
124+
- 选择 Java 扩展类型
125+
- 选择下载的JAR文件
126+
- 点击 Next 完成安装
127+
128+
### 🎯 功能特性
129+
- ✅ 自动从HTTP请求体中提取真实接口名称
130+
- ✅ 支持JSON、XML、表单数据等多种格式
131+
- ✅ 提供正则表达式、JSON路径、XPath等提取规则
132+
- ✅ 可视化配置界面,支持规则增删改
133+
- ✅ 配置导入导出功能
134+
- ✅ 支持Proxy、Intruder、Logger、Extensions工具类型
135+
136+
### 📚 使用文档
137+
- [用户指南](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/docs/user-guide.md)
138+
- [编辑功能测试指南](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/docs/edit-function-test-guide.md)
139+
- [项目README](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/README.md)
140+
141+
### ⚠️ 系统要求
142+
- Java 17或更高版本
143+
- Burp Suite Professional/Community 2020.12或更高版本
144+
145+
---
146+
147+
**如有问题或建议,请提交 [Issue](https://github.com/${{ github.repository }}/issues)**
148+
EOF
149+
150+
# 保存变更日志到文件
151+
echo "变更日志已生成"
152+
153+
- name: 创建GitHub Release
154+
id: create_release
155+
uses: actions/create-release@v1
156+
env:
157+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
158+
with:
159+
tag_name: ${{ steps.version.outputs.tag }}
160+
release_name: ShowMeUCode v${{ steps.version.outputs.version }}
161+
body_path: changelog_temp.md
162+
draft: false
163+
prerelease: false
164+
165+
- name: 上传JAR文件到Release
166+
uses: actions/upload-release-asset@v1
167+
env:
168+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
169+
with:
170+
upload_url: ${{ steps.create_release.outputs.upload_url }}
171+
asset_path: target/showMeUCode-${{ steps.version.outputs.version }}.jar
172+
asset_name: showMeUCode-${{ steps.version.outputs.version }}.jar
173+
asset_content_type: application/java-archive
174+
175+
- name: 上传项目文档
176+
uses: actions/upload-release-asset@v1
177+
env:
178+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
179+
with:
180+
upload_url: ${{ steps.create_release.outputs.upload_url }}
181+
asset_path: README.md
182+
asset_name: README.md
183+
asset_content_type: text/markdown
184+
185+
- name: 发布成功通知
186+
run: |
187+
echo "🎉 版本 ${{ steps.version.outputs.version }} 发布成功!"
188+
echo "📦 Release URL: ${{ steps.create_release.outputs.html_url }}"
189+
echo "📥 JAR下载: ${{ steps.create_release.outputs.html_url }}/download/showMeUCode-${{ steps.version.outputs.version }}.jar"
190+
echo ""
191+
echo "🚀 发布完成,您可以:"
192+
echo "1. 查看Release页面确认信息"
193+
echo "2. 测试下载的JAR文件"
194+
echo "3. 更新项目文档中的版本信息"

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ build/
3535
.vscode/
3636

3737
### Mac OS ###
38-
.DS_Store
38+
.DS_Store
39+
40+
### GitHub Actions ###
41+
changelog_temp.md
42+
43+
### Release Scripts ###
44+
*.bak
45+
*.tmp

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ ShowMeUCode插件通过自动从HTTP请求体中提取真实接口名称,并
5858

5959
## 构建说明
6060

61-
如需从源码构建:
61+
### 从源码构建
6262

6363
```bash
6464
git clone https://github.com/GitHubNull/showMeUCode.git
@@ -68,6 +68,28 @@ mvn clean package
6868

6969
构建完成后,JAR文件将位于`target`目录中。
7070

71+
### 自动发布
72+
73+
本项目配置了GitHub Actions自动发布流程:
74+
75+
#### 快速发布新版本
76+
```bash
77+
# 使用发布脚本(推荐)
78+
./scripts/release.sh 1.0.1
79+
80+
# 或手动创建tag
81+
git tag -a v1.0.1 -m "Release version 1.0.1"
82+
git push origin v1.0.1
83+
```
84+
85+
#### 自动发布功能
86+
- ✅ 自动编译构建JAR文件
87+
- ✅ 自动创建GitHub Release
88+
- ✅ 自动生成发布说明
89+
- ✅ 自动上传构建产物
90+
91+
详见:[GitHub Actions自动发布指南](docs/github-actions-guide.md)
92+
7193
## 系统要求
7294

7395
- Java 17或更高版本

0 commit comments

Comments
 (0)