Skip to content

Commit

Permalink
ci: 优化发布流程,添加自动生成发布说明和资源打包功能
Browse files Browse the repository at this point in the history
  • Loading branch information
snailyp committed Feb 13, 2025
1 parent 7b433aa commit 6e55a09
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 7 deletions.
54 changes: 54 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '新增功能'
labels:
- 'feature'
- 'enhancement'
- 'feat'
- title: '改进'
labels:
- 'improvement'
- 'optimization'
- 'refactor'
- title: '修复的Bug'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '已知问题'
labels:
- 'known issue'
- 'known-issue'
- title: '升级指南'
labels:
- 'breaking'
- 'breaking-change'

change-template: '- $TITLE (#$NUMBER)'
version-resolver:
major:
labels:
- 'breaking'
- 'breaking-change'
minor:
labels:
- 'feat'
- 'feature'
- 'enhancement'
patch:
labels:
- 'fix'
- 'bugfix'
- 'bug'
default: patch

template: |
## $RESOLVED_VERSION
**发布日期:** $RELEASE_DATE
$CHANGES
### 升级指南
- 请在升级前查看上述变更内容,确保您的应用程序兼容这些更改
- 如果存在数据库结构变更,请务必先备份数据再进行升级
27 changes: 20 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,28 @@ on:
- 'v*' # 当推送以 "v" 开头的标签时触发(如 v1.0.0, v2.1.0)

jobs:
release:
update-release-draft:
permissions:
contents: write # 添加写入权限
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
# Step 1: 检出代码库
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

# Step 2: 使用 release-drafter 生成发布说明
- name: Generate Release Notes
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Step 2: 自动生成 Release
# Step 3: 创建 Release
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -24,21 +36,22 @@ jobs:
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
body_path: CHANGELOG.md
draft: false
prerelease: false

# Step 3: 可选,构建zip文件
# Step 4: 构建zip文件
- name: Create ZIP file
run: |
zip -r gemini-balance.zip . -x "*.git*" "*.github*" "*.env*" "logs/*" "tests/*"
# Step 4: 可选,上传构建文件
# Step 5: 上传构建文件
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gemini-balance.zip # 替换为你的构建文件路径
asset_name: gemini-balance.zip # 替换为你的文件名
asset_path: ./gemini-balance.zip
asset_name: gemini-balance.zip
asset_content_type: application/zip

0 comments on commit 6e55a09

Please sign in to comment.