File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,34 @@ jobs:
4040 run : |
4141 Compress-Archive -Path * -DestinationPath ../ServicesApp-win-x64.zip
4242
43+ - name : 生成提交日志 (Generate Changelog)
44+ id : changelog
45+ run : |
46+ $tag = "${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref_name }}"
47+ $prevTag = git describe --tags --abbrev=0 "$tag^" 2>$null
48+ if ($prevTag) {
49+ $commits = git log "$prevTag..$tag" --pretty=format:"- %s (%h)" --no-merges
50+ } else {
51+ $commits = git log --pretty=format:"- %s (%h)" --no-merges -10
52+ }
53+ $changelog = $commits -join "`n"
54+ if ([string]::IsNullOrWhiteSpace($changelog)) {
55+ $changelog = "- 初始版本发布"
56+ }
57+ $changelog | Out-File -FilePath changelog.txt -Encoding utf8
58+ echo "CHANGELOG<<EOF" >> $env:GITHUB_OUTPUT
59+ echo $changelog >> $env:GITHUB_OUTPUT
60+ echo "EOF" >> $env:GITHUB_OUTPUT
61+
4362 - name : 创建 GitHub Release
4463 if : startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
4564 uses : softprops/action-gh-release@v1
4665 with :
4766 files : ServicesApp-win-x64.zip
48- generate_release_notes : true
67+ body : |
68+ ## 更新内容
69+
70+ ${{ steps.changelog.outputs.CHANGELOG }}
4971 tag_name : ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref_name }}
5072 name : Release ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref_name }}
5173 draft : false
You can’t perform that action at this time.
0 commit comments