mirror of
https://gitee.com/WuKongDev/WuKongIM.git
synced 2025-12-06 06:49:06 +08:00
docs: update changelog for v2.2.1-20250624
This commit is contained in:
90
.github/workflows/go-ossf-slsa3-publish.yml
vendored
90
.github/workflows/go-ossf-slsa3-publish.yml
vendored
@@ -20,9 +20,99 @@ on:
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
# Extract changelog content for the release version
|
||||
changelog:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
outputs:
|
||||
release-notes: ${{ steps.extract.outputs.notes }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Extract changelog for version
|
||||
id: extract
|
||||
run: |
|
||||
# Get the version from the tag (e.g., v2.2.1-20250624)
|
||||
VERSION="${GITHUB_REF_NAME}"
|
||||
echo "Extracting changelog for version: $VERSION"
|
||||
|
||||
# Create a script to extract the changelog section
|
||||
cat > extract_changelog.sh << 'SCRIPT'
|
||||
#!/bin/bash
|
||||
VERSION="$1"
|
||||
CHANGELOG_FILE="CHANGELOG.md"
|
||||
|
||||
# Find the line number where this version starts
|
||||
START_LINE=$(grep -n "^## \[$VERSION\]" "$CHANGELOG_FILE" | cut -d: -f1)
|
||||
|
||||
if [ -z "$START_LINE" ]; then
|
||||
echo "Warning: Version $VERSION not found in CHANGELOG.md"
|
||||
echo "## Release $VERSION" > release_notes.md
|
||||
echo "" >> release_notes.md
|
||||
echo "See [CHANGELOG.md](https://github.com/$GITHUB_REPOSITORY/blob/$VERSION/CHANGELOG.md) for details." >> release_notes.md
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find the line number where the next version starts (or end of file)
|
||||
NEXT_VERSION_LINE=$(tail -n +$((START_LINE + 1)) "$CHANGELOG_FILE" | grep -n "^## \[" | head -1 | cut -d: -f1)
|
||||
|
||||
if [ -z "$NEXT_VERSION_LINE" ]; then
|
||||
# No next version found, extract to end of file
|
||||
sed -n "${START_LINE},\$p" "$CHANGELOG_FILE" > release_notes.md
|
||||
else
|
||||
# Calculate the actual line number
|
||||
END_LINE=$((START_LINE + NEXT_VERSION_LINE - 1))
|
||||
# Extract the section, excluding the next version header
|
||||
sed -n "${START_LINE},$((END_LINE - 1))p" "$CHANGELOG_FILE" > release_notes.md
|
||||
fi
|
||||
|
||||
# Remove the version header line
|
||||
sed -i '1d' release_notes.md
|
||||
|
||||
# Remove trailing --- separators
|
||||
sed -i '/^---$/d' release_notes.md
|
||||
|
||||
# Remove trailing empty lines using awk (more portable)
|
||||
awk 'NF {p=1} p' release_notes.md > release_notes.tmp && mv release_notes.tmp release_notes.md
|
||||
SCRIPT
|
||||
|
||||
chmod +x extract_changelog.sh
|
||||
./extract_changelog.sh "$VERSION"
|
||||
|
||||
# Check if extraction was successful
|
||||
if [ -f release_notes.md ]; then
|
||||
echo "Successfully extracted changelog"
|
||||
cat release_notes.md
|
||||
|
||||
# Save to output using heredoc to handle multiline content
|
||||
{
|
||||
echo 'notes<<EOF'
|
||||
cat release_notes.md
|
||||
echo EOF
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "Failed to extract changelog"
|
||||
echo "notes=## Release $VERSION" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Update release with changelog
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# Update the release body with the extracted changelog
|
||||
gh release edit "$GITHUB_REF_NAME" \
|
||||
--notes-file release_notes.md \
|
||||
--repo "$GITHUB_REPOSITORY"
|
||||
|
||||
# Generate ldflags dynamically.
|
||||
# Optional: only needed for ldflags.
|
||||
args:
|
||||
needs: changelog
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
commit-date: ${{ steps.ldflags.outputs.commit-date }}
|
||||
|
||||
188
CHANGELOG.md
188
CHANGELOG.md
@@ -1,5 +1,191 @@
|
||||
# WuKongIM Changelog
|
||||
|
||||
## [v2.2.1-20250624] - 2025-06-24
|
||||
|
||||
### 🚀 Major Features
|
||||
|
||||
#### Event-Based Messaging System
|
||||
- **Event Message Support**: Introduced event-based messaging protocol replacing chunk-based notifications for improved real-time communication
|
||||
- **事件消息支持**: 引入基于事件的消息协议,替代基于块的通知,提升实时通信能力
|
||||
- **Text Event Support**: Added support for text events with enhanced event handling capabilities
|
||||
- **文本事件支持**: 添加文本事件支持,增强事件处理能力
|
||||
|
||||
#### Stream V2 Implementation
|
||||
- **Completed Stream V2**: New streaming protocol implementation with improved performance and reliability
|
||||
- **完成Stream V2**: 新的流式协议实现,提升性能和可靠性
|
||||
- **Stream Message Support**: Enhanced message streaming capabilities with better caching and storage
|
||||
- **流式消息支持**: 增强消息流式传输能力,改进缓存和存储
|
||||
|
||||
#### Agent & Visitor Channel Support
|
||||
- **Agent Channel**: Added support for agent channels enabling customer service and support scenarios
|
||||
- **客服频道**: 添加客服频道支持,支持客户服务场景
|
||||
- **Visitor Channel**: Implemented visitor channel functionality for anonymous user interactions
|
||||
- **访客频道**: 实现访客频道功能,支持匿名用户交互
|
||||
- **Agent Support**: Comprehensive agent system with connection management and event handling
|
||||
- **客服系统**: 完整的客服系统,支持连接管理和事件处理
|
||||
|
||||
### 🆕 New Features
|
||||
|
||||
#### API & Documentation
|
||||
- **OpenAPI Documentation**: Added comprehensive OpenAPI 3.0 specification and interactive documentation
|
||||
- **OpenAPI文档**: 添加完整的OpenAPI 3.0规范和交互式文档
|
||||
- **Event API**: New event-based API endpoints for real-time message handling
|
||||
- **事件API**: 新的基于事件的API端点,用于实时消息处理
|
||||
- **Message API Enhancements**: Improved message API with better event handling and distribution
|
||||
- **消息API增强**: 改进消息API,提升事件处理和分发能力
|
||||
|
||||
#### Permission System
|
||||
- **Permission Service**: New centralized permission service for unified access control
|
||||
- **权限服务**: 新的集中式权限服务,统一访问控制
|
||||
- **Cross-Node Permission Checks**: Support for distributed permission validation across cluster nodes
|
||||
- **跨节点权限检查**: 支持集群节点间的分布式权限验证
|
||||
|
||||
#### Caching Improvements
|
||||
- **Conversation Cache**: Added LRU caching for conversations to improve query performance
|
||||
- **会话缓存**: 为会话添加LRU缓存,提升查询性能
|
||||
- **Stream Cache**: Implemented comprehensive caching system for stream messages
|
||||
- **流式缓存**: 实现流式消息的完整缓存系统
|
||||
- **Cache Service**: New cache service layer for better data access patterns
|
||||
- **缓存服务**: 新的缓存服务层,优化数据访问模式
|
||||
|
||||
#### Channel Management
|
||||
- **SendBan Setting**: Added SendBan configuration for channel-level message restrictions
|
||||
- **SendBan设置**: 添加频道级别的SendBan配置,限制消息发送
|
||||
- **AllowStranger Setting**: Implemented AllowStranger setting to control stranger message permissions
|
||||
- **AllowStranger设置**: 实现AllowStranger设置,控制陌生人消息权限
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
#### Distributed System Fixes
|
||||
- **Slot Log Conflict**: Fixed distributed slot log conflict that prevented message delivery
|
||||
- **槽位日志冲突**: 修复分布式槽位日志冲突导致消息发送失败的问题
|
||||
- **Raft Not Found**: Resolved cluster raft not found error when replica count is less than node count
|
||||
- **Raft未找到**: 解决副本数小于节点数时集群raft未找到的错误
|
||||
- **Chunk ID Generation**: Removed problematic chunk ID generator to prevent conflicts
|
||||
- **块ID生成**: 移除有问题的块ID生成器,防止冲突
|
||||
|
||||
#### Channel & Permission Fixes
|
||||
- **SendBan/AllowStranger**: Fixed SendBan and AllowStranger settings not taking effect
|
||||
- **SendBan/AllowStranger**: 修复SendBan和AllowStranger设置不生效的问题
|
||||
- **Visitor Messages**: Fixed issue where visitors could not receive messages
|
||||
- **访客消息**: 修复访客无法接收消息的问题
|
||||
|
||||
### 🔧 Technical Improvements
|
||||
|
||||
#### Protocol Enhancements
|
||||
- **JSON-RPC Protocol**: Updated JSON-RPC protocol with event-based notifications
|
||||
- **JSON-RPC协议**: 更新JSON-RPC协议,支持基于事件的通知
|
||||
- **Event Schema**: New event schema with header, id, type, timestamp, and data fields
|
||||
- **事件模式**: 新的事件模式,包含header、id、type、timestamp和data字段
|
||||
|
||||
#### Code Quality & Architecture
|
||||
- **Service Layer Refactoring**: Introduced service layer for better separation of concerns
|
||||
- **服务层重构**: 引入服务层,更好地分离关注点
|
||||
- **Permission Service Extraction**: Extracted permission logic into reusable service
|
||||
- **权限服务提取**: 将权限逻辑提取到可复用的服务中
|
||||
- **API Reorganization**: Moved channel message sync APIs to dedicated message endpoints
|
||||
- **API重组**: 将频道消息同步API移至专用消息端点
|
||||
|
||||
#### Cluster Improvements
|
||||
- **RPC Client Enhancements**: Added new RPC methods for cross-node communication
|
||||
- **RPC客户端增强**: 添加新的RPC方法用于跨节点通信
|
||||
- **Slot Management**: Improved slot replica management and configuration
|
||||
- **槽位管理**: 改进槽位副本管理和配置
|
||||
- **Raft Timing Optimization**: Enhanced raft tick timing and keepalive mechanisms
|
||||
- **Raft时序优化**: 增强raft tick时序和保活机制
|
||||
|
||||
#### Database & Storage
|
||||
- **Stream V2 Storage**: New storage layer for stream v2 messages
|
||||
- **Stream V2存储**: 新的Stream V2消息存储层
|
||||
- **Conversation Storage**: Enhanced conversation storage with caching support
|
||||
- **会话存储**: 增强会话存储,支持缓存
|
||||
- **Key Management**: Improved database key management for stream messages
|
||||
- **键管理**: 改进流式消息的数据库键管理
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
#### New Documentation
|
||||
- **OpenAPI Specification**: Complete OpenAPI 3.0 specification with 4000+ lines
|
||||
- **OpenAPI规范**: 完整的OpenAPI 3.0规范,超过4000行
|
||||
- **API Documentation**: Interactive API documentation with examples
|
||||
- **API文档**: 带示例的交互式API文档
|
||||
- **Release Notes**: Added detailed release notes for v2.2.0-20250426
|
||||
- **发布说明**: 添加v2.2.0-20250426的详细发布说明
|
||||
- **Cache Documentation**: Comprehensive documentation for caching system
|
||||
- **缓存文档**: 缓存系统的完整文档
|
||||
|
||||
#### Configuration Updates
|
||||
- **Example Configs**: Updated example configuration files with new options
|
||||
- **示例配置**: 更新示例配置文件,添加新选项
|
||||
- **Config Documentation**: Enhanced configuration documentation in wk.yaml
|
||||
- **配置文档**: 增强wk.yaml中的配置文档
|
||||
|
||||
### 🎨 UI/UX Improvements
|
||||
|
||||
#### Chat Demo
|
||||
- **Event Message Display**: Updated chat demo to support event message display
|
||||
- **事件消息显示**: 更新聊天演示以支持事件消息显示
|
||||
- **Message Conversion**: Improved message conversion and rendering
|
||||
- **消息转换**: 改进消息转换和渲染
|
||||
- **Dependency Updates**: Updated chat demo dependencies for better compatibility
|
||||
- **依赖更新**: 更新聊天演示依赖以提高兼容性
|
||||
|
||||
#### Web Interface
|
||||
- **Cluster Slot UI**: Enhanced cluster slot management interface
|
||||
- **集群槽位界面**: 增强集群槽位管理界面
|
||||
- **API Integration**: Improved web interface API integration
|
||||
- **API集成**: 改进Web界面API集成
|
||||
|
||||
### 🔄 Breaking Changes
|
||||
|
||||
#### API Changes
|
||||
- **Channel Message Sync Removed**: Removed `/channel/messagesync` and `/channel/max_message_seq` endpoints (moved to message API)
|
||||
- **频道消息同步移除**: 移除`/channel/messagesync`和`/channel/max_message_seq`端点(移至消息API)
|
||||
- **Event Protocol**: Changed from chunk-based to event-based notification protocol
|
||||
- **事件协议**: 从基于块的通知协议改为基于事件的通知协议
|
||||
|
||||
#### Internal Changes
|
||||
- **Chunk ID Generator Removed**: Removed internal chunk ID generation mechanism
|
||||
- **块ID生成器移除**: 移除内部块ID生成机制
|
||||
- **Service Layer Introduction**: New service layer may affect internal integrations
|
||||
- **服务层引入**: 新的服务层可能影响内部集成
|
||||
|
||||
### 🛠️ Development & Testing
|
||||
|
||||
#### Testing Improvements
|
||||
- **Event Tests**: Added comprehensive test suite for event-based messaging
|
||||
- **事件测试**: 添加基于事件的消息传递的完整测试套件
|
||||
- **Stream Tests**: Enhanced stream caching and storage tests
|
||||
- **流式测试**: 增强流式缓存和存储测试
|
||||
- **Cache Tests**: Added example tests for caching functionality
|
||||
- **缓存测试**: 添加缓存功能的示例测试
|
||||
|
||||
#### Build & Deployment
|
||||
- **Makefile Updates**: Updated build and deployment scripts
|
||||
- **Makefile更新**: 更新构建和部署脚本
|
||||
- **Docker Tags**: Updated Docker image tags for new version
|
||||
- **Docker标签**: 更新新版本的Docker镜像标签
|
||||
|
||||
### 📊 Project Updates
|
||||
|
||||
#### Repository Management
|
||||
- **Issue Templates**: Added bug report template for better issue tracking
|
||||
- **问题模板**: 添加错误报告模板以更好地跟踪问题
|
||||
- **README Updates**: Updated README files with 10-year project milestone
|
||||
- **README更新**: 更新README文件,标注10年项目里程碑
|
||||
- **Changelog**: Added comprehensive changelog tracking
|
||||
- **变更日志**: 添加完整的变更日志跟踪
|
||||
|
||||
### 🔗 Dependencies
|
||||
|
||||
#### Go Module Updates
|
||||
- **WuKongIMGoProto**: Updated to latest version for event support
|
||||
- **WuKongIMGoProto**: 更新到最新版本以支持事件
|
||||
- **Chat Demo Dependencies**: Updated marked library and other frontend dependencies
|
||||
- **聊天演示依赖**: 更新marked库和其他前端依赖
|
||||
|
||||
---
|
||||
|
||||
## [v2.2.0-20250426] - 2025-06-24
|
||||
|
||||
### 🚀 Major Features
|
||||
@@ -112,4 +298,4 @@ For previous release notes, see the git history.
|
||||
|
||||
---
|
||||
|
||||
**Full Changelog**: https://github.com/WuKongIM/WuKongIM/compare/v2.1.5-20250424...v2.2.0-20250426
|
||||
**Full Changelog**: https://github.com/WuKongIM/WuKongIM/compare/v2.2.0-20250426...v2.2.1-20250624
|
||||
|
||||
234
docs/RELEASE_CHECKLIST.md
Normal file
234
docs/RELEASE_CHECKLIST.md
Normal file
@@ -0,0 +1,234 @@
|
||||
# Release Checklist
|
||||
|
||||
Quick reference guide for creating a new release with automatic changelog integration.
|
||||
|
||||
## Pre-Release Checklist
|
||||
|
||||
- [ ] All changes merged to main branch
|
||||
- [ ] All tests passing
|
||||
- [ ] Version number decided (format: `vX.Y.Z-YYYYMMDD`)
|
||||
- [ ] CHANGELOG.md updated with new version entry
|
||||
|
||||
## Step-by-Step Release Process
|
||||
|
||||
### 1. Update CHANGELOG.md
|
||||
|
||||
```bash
|
||||
# Edit CHANGELOG.md and add new version section at the top
|
||||
# Format:
|
||||
## [v2.2.1-20250624] - 2025-06-24
|
||||
|
||||
### 🚀 Major Features
|
||||
...
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
...
|
||||
```
|
||||
|
||||
**Important**: The version in brackets `[v2.2.1-20250624]` must match your Git tag exactly!
|
||||
|
||||
### 2. Commit and Push Changes
|
||||
|
||||
```bash
|
||||
git add CHANGELOG.md
|
||||
git commit -m "docs: update changelog for v2.2.1-20250624"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### 3. Create GitHub Release
|
||||
|
||||
#### Option A: Via GitHub UI (Recommended)
|
||||
|
||||
1. Go to: https://github.com/WuKongIM/WuKongIM/releases/new
|
||||
2. Click "Choose a tag"
|
||||
3. Type the new version: `v2.2.1-20250624`
|
||||
4. Click "Create new tag: v2.2.1-20250624 on publish"
|
||||
5. Release title: `Release v2.2.1-20250624`
|
||||
6. Description: Leave empty (will be auto-filled from CHANGELOG.md)
|
||||
7. Click "Publish release"
|
||||
|
||||
#### Option B: Via Git Command Line
|
||||
|
||||
```bash
|
||||
# Create and push tag
|
||||
git tag v2.2.1-20250624
|
||||
git push origin v2.2.1-20250624
|
||||
|
||||
# Then create release from tag on GitHub UI
|
||||
```
|
||||
|
||||
### 4. Monitor Workflow
|
||||
|
||||
1. Go to: https://github.com/WuKongIM/WuKongIM/actions
|
||||
2. Watch the "SLSA Go releaser" workflow
|
||||
3. Verify all jobs complete successfully:
|
||||
- ✅ changelog
|
||||
- ✅ args
|
||||
- ✅ build (4 matrix jobs)
|
||||
- ✅ verification
|
||||
|
||||
### 5. Verify Release
|
||||
|
||||
1. Go to: https://github.com/WuKongIM/WuKongIM/releases
|
||||
2. Click on the new release
|
||||
3. Verify:
|
||||
- [ ] Release notes populated from CHANGELOG.md
|
||||
- [ ] Bilingual content (English/Chinese) preserved
|
||||
- [ ] All binaries uploaded (4 files + provenance)
|
||||
- [ ] SLSA provenance files present
|
||||
|
||||
## Post-Release Checklist
|
||||
|
||||
- [ ] Release notes look correct
|
||||
- [ ] All binaries downloadable
|
||||
- [ ] Docker images published (separate workflow)
|
||||
- [ ] Announcement prepared (if needed)
|
||||
- [ ] Documentation updated (if needed)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Release notes are empty or incorrect
|
||||
|
||||
**Check:**
|
||||
1. Version tag matches CHANGELOG.md exactly
|
||||
2. CHANGELOG.md format is correct: `## [vX.Y.Z-YYYYMMDD]`
|
||||
3. Workflow logs for errors
|
||||
|
||||
**Fix:**
|
||||
```bash
|
||||
# Test extraction locally
|
||||
./test_changelog_extraction.sh v2.2.1-20250624
|
||||
|
||||
# If successful, manually update release
|
||||
gh release edit v2.2.1-20250624 --notes-file release_notes_test.md
|
||||
```
|
||||
|
||||
### Workflow fails
|
||||
|
||||
**Common issues:**
|
||||
1. **Permission denied**: Check repository settings → Actions → Workflow permissions
|
||||
2. **Tag already exists**: Delete tag and recreate
|
||||
3. **Build fails**: Check Go version compatibility
|
||||
|
||||
**View logs:**
|
||||
```bash
|
||||
# Using GitHub CLI
|
||||
gh run list --workflow=go-ossf-slsa3-publish.yml
|
||||
gh run view <run-id> --log
|
||||
```
|
||||
|
||||
### Need to update release notes after publishing
|
||||
|
||||
```bash
|
||||
# Edit CHANGELOG.md
|
||||
git add CHANGELOG.md
|
||||
git commit -m "docs: fix changelog for v2.2.1-20250624"
|
||||
git push
|
||||
|
||||
# Extract and update manually
|
||||
./test_changelog_extraction.sh v2.2.1-20250624
|
||||
gh release edit v2.2.1-20250624 --notes-file release_notes_test.md
|
||||
```
|
||||
|
||||
## Quick Commands Reference
|
||||
|
||||
```bash
|
||||
# Test changelog extraction locally
|
||||
./test_changelog_extraction.sh v2.2.1-20250624
|
||||
|
||||
# Create and push tag
|
||||
git tag v2.2.1-20250624
|
||||
git push origin v2.2.1-20250624
|
||||
|
||||
# Delete tag (if needed)
|
||||
git tag -d v2.2.1-20250624
|
||||
git push origin :refs/tags/v2.2.1-20250624
|
||||
|
||||
# View releases
|
||||
gh release list
|
||||
|
||||
# View specific release
|
||||
gh release view v2.2.1-20250624
|
||||
|
||||
# Edit release notes manually
|
||||
gh release edit v2.2.1-20250624 --notes "New content"
|
||||
|
||||
# Edit release notes from file
|
||||
gh release edit v2.2.1-20250624 --notes-file release_notes.md
|
||||
|
||||
# Download release assets
|
||||
gh release download v2.2.1-20250624
|
||||
|
||||
# View workflow runs
|
||||
gh run list --workflow=go-ossf-slsa3-publish.yml
|
||||
|
||||
# Watch workflow run
|
||||
gh run watch
|
||||
```
|
||||
|
||||
## Version Naming Convention
|
||||
|
||||
Format: `vMAJOR.MINOR.PATCH-YYYYMMDD`
|
||||
|
||||
Examples:
|
||||
- `v2.2.1-20250624` - Version 2.2.1 released on June 24, 2025
|
||||
- `v2.3.0-20250701` - Version 2.3.0 released on July 1, 2025
|
||||
- `v3.0.0-20260101` - Version 3.0.0 released on January 1, 2026
|
||||
|
||||
## CHANGELOG.md Template
|
||||
|
||||
```markdown
|
||||
## [vX.Y.Z-YYYYMMDD] - YYYY-MM-DD
|
||||
|
||||
### 🚀 Major Features
|
||||
|
||||
#### Feature Category
|
||||
- **Feature Name**: Description in English
|
||||
- **功能名称**: 中文描述
|
||||
|
||||
### 🆕 New Features
|
||||
|
||||
#### Category
|
||||
- **Feature**: Description
|
||||
- **功能**: 描述
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
#### Category
|
||||
- **Fix**: Description
|
||||
- **修复**: 描述
|
||||
|
||||
### 🔧 Technical Improvements
|
||||
|
||||
#### Category
|
||||
- **Improvement**: Description
|
||||
- **改进**: 描述
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- **Docs**: Description
|
||||
- **文档**: 描述
|
||||
|
||||
### 🔄 Breaking Changes
|
||||
|
||||
- **Change**: Description
|
||||
- **变更**: 描述
|
||||
|
||||
---
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Release Workflow Documentation](./RELEASE_WORKFLOW.md)
|
||||
- [GitHub Releases Guide](https://docs.github.com/en/repositories/releasing-projects-on-github)
|
||||
- [SLSA Framework](https://slsa.dev/)
|
||||
- [GitHub CLI Documentation](https://cli.github.com/manual/)
|
||||
|
||||
## Support
|
||||
|
||||
If you encounter issues:
|
||||
1. Check workflow logs in GitHub Actions
|
||||
2. Test locally with `test_changelog_extraction.sh`
|
||||
3. Review [RELEASE_WORKFLOW.md](./RELEASE_WORKFLOW.md) for detailed troubleshooting
|
||||
4. Open an issue if the problem persists
|
||||
|
||||
232
docs/RELEASE_WORKFLOW.md
Normal file
232
docs/RELEASE_WORKFLOW.md
Normal file
@@ -0,0 +1,232 @@
|
||||
# Release Workflow Documentation
|
||||
|
||||
## Overview
|
||||
|
||||
The GitHub Actions workflow at `.github/workflows/go-ossf-slsa3-publish.yml` has been enhanced to automatically populate GitHub release notes with content from `CHANGELOG.md`.
|
||||
|
||||
## How It Works
|
||||
|
||||
### Workflow Trigger
|
||||
|
||||
The workflow is triggered in two ways:
|
||||
1. **Automatic**: When a new release is created on GitHub (`release.types: [created]`)
|
||||
2. **Manual**: Via workflow dispatch from the GitHub Actions UI
|
||||
|
||||
### Workflow Jobs
|
||||
|
||||
#### 1. Changelog Extraction Job
|
||||
|
||||
This job runs first and extracts the relevant changelog content for the release version:
|
||||
|
||||
**Steps:**
|
||||
1. **Checkout**: Checks out the repository code
|
||||
2. **Extract changelog**:
|
||||
- Identifies the version from the Git tag (e.g., `v2.2.1-20250624`)
|
||||
- Searches for the matching version section in `CHANGELOG.md`
|
||||
- Extracts all content between the version header and the next version header
|
||||
- Removes the version header line and trailing separators
|
||||
- Saves the extracted content to `release_notes.md`
|
||||
3. **Update release**: Updates the GitHub release with the extracted changelog content
|
||||
|
||||
**Key Features:**
|
||||
- ✅ Handles bilingual content (English/Chinese) automatically
|
||||
- ✅ Preserves all formatting, emojis, and markdown structure
|
||||
- ✅ Falls back to a default message if version not found in CHANGELOG.md
|
||||
- ✅ Removes unnecessary separators and trailing whitespace
|
||||
|
||||
#### 2. Args Job
|
||||
|
||||
Generates build flags (ldflags) for the Go build process. This job depends on the changelog job completing first.
|
||||
|
||||
#### 3. Build Job
|
||||
|
||||
Builds the Go binaries using the SLSA3 compliant builder for multiple platforms:
|
||||
- Linux (amd64, arm64)
|
||||
- Darwin/macOS (amd64, arm64)
|
||||
|
||||
#### 4. Verification Job
|
||||
|
||||
Verifies the built artifacts using SLSA verifier to ensure supply chain security.
|
||||
|
||||
## Usage
|
||||
|
||||
### Creating a New Release
|
||||
|
||||
#### Option 1: Using GitHub UI (Recommended)
|
||||
|
||||
1. **Update CHANGELOG.md**:
|
||||
```bash
|
||||
# Make sure your CHANGELOG.md has an entry for the new version
|
||||
# Format: ## [vX.Y.Z-YYYYMMDD] - YYYY-MM-DD
|
||||
```
|
||||
|
||||
2. **Commit and push changes**:
|
||||
```bash
|
||||
git add CHANGELOG.md
|
||||
git commit -m "docs: update changelog for vX.Y.Z-YYYYMMDD"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
3. **Create a new release on GitHub**:
|
||||
- Go to: https://github.com/WuKongIM/WuKongIM/releases/new
|
||||
- Choose or create a tag (e.g., `v2.2.1-20250624`)
|
||||
- Title: `Release v2.2.1-20250624`
|
||||
- Description: Leave empty or add a brief summary (will be replaced by changelog)
|
||||
- Click "Publish release"
|
||||
|
||||
4. **Workflow automatically runs**:
|
||||
- The workflow detects the new release
|
||||
- Extracts the changelog content for the version
|
||||
- Updates the release notes automatically
|
||||
- Builds and uploads binaries
|
||||
- Verifies the artifacts
|
||||
|
||||
#### Option 2: Using Git Tags
|
||||
|
||||
1. **Update CHANGELOG.md** (same as above)
|
||||
|
||||
2. **Create and push a tag**:
|
||||
```bash
|
||||
git tag v2.2.1-20250624
|
||||
git push origin v2.2.1-20250624
|
||||
```
|
||||
|
||||
3. **Create release from tag**:
|
||||
- Go to the tag on GitHub
|
||||
- Click "Create release from tag"
|
||||
- The workflow will run automatically
|
||||
|
||||
#### Option 3: Manual Workflow Dispatch
|
||||
|
||||
1. Go to: https://github.com/WuKongIM/WuKongIM/actions/workflows/go-ossf-slsa3-publish.yml
|
||||
2. Click "Run workflow"
|
||||
3. Select the branch
|
||||
4. Click "Run workflow"
|
||||
|
||||
**Note**: Manual dispatch requires a release to already exist for the current tag.
|
||||
|
||||
## CHANGELOG.md Format Requirements
|
||||
|
||||
For the automatic extraction to work correctly, your `CHANGELOG.md` must follow this format:
|
||||
|
||||
```markdown
|
||||
# WuKongIM Changelog
|
||||
|
||||
## [v2.2.1-20250624] - 2025-06-24
|
||||
|
||||
### 🚀 Major Features
|
||||
- Feature description
|
||||
- 功能描述
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
- Bug fix description
|
||||
- 错误修复描述
|
||||
|
||||
---
|
||||
|
||||
## [v2.2.0-20250426] - 2025-04-26
|
||||
|
||||
### Features
|
||||
...
|
||||
```
|
||||
|
||||
**Important Rules:**
|
||||
1. Version headers must start with `## [vX.Y.Z-YYYYMMDD]`
|
||||
2. The version tag in brackets must match the Git tag exactly
|
||||
3. Each version section is separated by the next version header
|
||||
4. The `---` separator is optional and will be removed automatically
|
||||
5. Both English and Chinese content are preserved
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Release notes not updated
|
||||
|
||||
**Possible causes:**
|
||||
1. Version not found in CHANGELOG.md
|
||||
- **Solution**: Ensure the version tag matches exactly (e.g., `v2.2.1-20250624`)
|
||||
|
||||
2. CHANGELOG.md format incorrect
|
||||
- **Solution**: Check that version header follows the format `## [vX.Y.Z-YYYYMMDD]`
|
||||
|
||||
3. Workflow permissions issue
|
||||
- **Solution**: Ensure the workflow has `contents: write` permission
|
||||
|
||||
### Checking workflow logs
|
||||
|
||||
1. Go to: https://github.com/WuKongIM/WuKongIM/actions
|
||||
2. Click on the workflow run
|
||||
3. Click on the "changelog" job
|
||||
4. Expand "Extract changelog for version" step
|
||||
5. Review the output to see what was extracted
|
||||
|
||||
### Manual verification
|
||||
|
||||
You can test the changelog extraction locally using the test script:
|
||||
|
||||
```bash
|
||||
# Make the test script executable
|
||||
chmod +x test_changelog_extraction.sh
|
||||
|
||||
# Run the test for a specific version
|
||||
./test_changelog_extraction.sh v2.2.1-20250624
|
||||
|
||||
# Check the output
|
||||
cat release_notes_test.md
|
||||
```
|
||||
|
||||
## Example Output
|
||||
|
||||
When the workflow runs successfully, the GitHub release will contain:
|
||||
|
||||
```markdown
|
||||
### 🚀 Major Features
|
||||
|
||||
#### Event-Based Messaging System
|
||||
- **Event Message Support**: Introduced event-based messaging protocol...
|
||||
- **事件消息支持**: 引入基于事件的消息协议...
|
||||
|
||||
### 🆕 New Features
|
||||
|
||||
#### API & Documentation
|
||||
- **OpenAPI Documentation**: Added comprehensive OpenAPI 3.0 specification...
|
||||
- **OpenAPI文档**: 添加完整的OpenAPI 3.0规范...
|
||||
|
||||
[... full changelog content ...]
|
||||
```
|
||||
|
||||
## Benefits
|
||||
|
||||
1. **Consistency**: Release notes always match the CHANGELOG.md
|
||||
2. **Automation**: No manual copy-paste required
|
||||
3. **Bilingual Support**: Preserves both English and Chinese content
|
||||
4. **Version Control**: Changelog is version controlled with the code
|
||||
5. **Transparency**: Clear history of all changes in one place
|
||||
|
||||
## Related Files
|
||||
|
||||
- `.github/workflows/go-ossf-slsa3-publish.yml` - Main workflow file
|
||||
- `CHANGELOG.md` - Changelog source
|
||||
- `test_changelog_extraction.sh` - Local testing script
|
||||
- `docs/RELEASE_WORKFLOW.md` - This documentation
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Updating the extraction logic
|
||||
|
||||
If you need to modify how changelog content is extracted:
|
||||
|
||||
1. Edit the script in `.github/workflows/go-ossf-slsa3-publish.yml`
|
||||
2. Test locally using `test_changelog_extraction.sh`
|
||||
3. Commit and push changes
|
||||
4. Test with a draft release before using in production
|
||||
|
||||
### Adding new changelog sections
|
||||
|
||||
The extraction script preserves all content between version headers, so you can:
|
||||
- Add new emoji categories (e.g., 🔒 Security)
|
||||
- Change section names
|
||||
- Add subsections
|
||||
- Include any markdown formatting
|
||||
|
||||
All changes will be automatically included in the release notes.
|
||||
|
||||
62
test_changelog_extraction.sh
Executable file
62
test_changelog_extraction.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Test script to verify changelog extraction logic
|
||||
# This simulates what the GitHub Actions workflow will do
|
||||
|
||||
VERSION="${1:-v2.2.1-20250624}"
|
||||
CHANGELOG_FILE="CHANGELOG.md"
|
||||
|
||||
echo "Testing changelog extraction for version: $VERSION"
|
||||
echo "================================================"
|
||||
|
||||
# Find the line number where this version starts
|
||||
START_LINE=$(grep -n "^## \[$VERSION\]" "$CHANGELOG_FILE" | cut -d: -f1)
|
||||
|
||||
if [ -z "$START_LINE" ]; then
|
||||
echo "ERROR: Version $VERSION not found in CHANGELOG.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Found version at line: $START_LINE"
|
||||
|
||||
# Find the line number where the next version starts (or end of file)
|
||||
NEXT_VERSION_LINE=$(tail -n +$((START_LINE + 1)) "$CHANGELOG_FILE" | grep -n "^## \[" | head -1 | cut -d: -f1)
|
||||
|
||||
if [ -z "$NEXT_VERSION_LINE" ]; then
|
||||
echo "No next version found, extracting to end of file"
|
||||
# No next version found, extract to end of file
|
||||
sed -n "${START_LINE},\$p" "$CHANGELOG_FILE" > release_notes_test.md
|
||||
else
|
||||
# Calculate the actual line number
|
||||
END_LINE=$((START_LINE + NEXT_VERSION_LINE - 1))
|
||||
echo "Next version found at relative line: $NEXT_VERSION_LINE (absolute: $END_LINE)"
|
||||
# Extract the section, excluding the next version header
|
||||
sed -n "${START_LINE},$((END_LINE - 1))p" "$CHANGELOG_FILE" > release_notes_test.md
|
||||
fi
|
||||
|
||||
# Remove the version header line
|
||||
sed -i.bak '1d' release_notes_test.md
|
||||
|
||||
# Remove trailing --- separators
|
||||
sed -i.bak '/^---$/d' release_notes_test.md
|
||||
|
||||
# Trim trailing empty lines using a simpler approach
|
||||
# Use perl which is more portable and reliable
|
||||
perl -i -pe 'chomp if eof' release_notes_test.md
|
||||
|
||||
# Alternative: use awk to remove trailing blank lines
|
||||
awk 'NF {p=1} p' release_notes_test.md > release_notes_test.tmp && mv release_notes_test.tmp release_notes_test.md
|
||||
|
||||
# Clean up backup files
|
||||
rm -f release_notes_test.md.bak
|
||||
|
||||
echo ""
|
||||
echo "Extraction complete! Preview of release_notes_test.md:"
|
||||
echo "================================================"
|
||||
head -50 release_notes_test.md
|
||||
echo ""
|
||||
echo "================================================"
|
||||
echo "Total lines extracted: $(wc -l < release_notes_test.md)"
|
||||
echo ""
|
||||
echo "Full content saved to: release_notes_test.md"
|
||||
|
||||
Reference in New Issue
Block a user