Skip to content

Commit

Permalink
ci(feat): 尝试对自动创建的release, 自动生成最新对应的changelog内容
Browse files Browse the repository at this point in the history
  • Loading branch information
LuSrackhall committed Aug 22, 2024
1 parent fd0d504 commit 582dac1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ jobs:
choco install zip -y
zip -j -9 ${INSTALLER_NAME_NO_EXE}_exe.zip ${INSTALLER_NAME}

- name: Extract changelog for this release
shell: bash
run: | # 提取最新版本的changelog内容
# 提取最新两个 # 之间的内容 , 并将内容编码为 Base64
CHANGELOG=$(sed -n '/^#/!b;//{h;d}; x;p' CHANGELOG.md | sed -n '/^#/!b;1!p' | base64)
# 如果只存在一个 # 标记,则提取其下方的所有内容
if [[ -z "$CHANGELOG" ]]; then
CHANGELOG=$(sed -n '/^#/,$p' CHANGELOG.md | base64)
fi
echo "CHANGELOG=$ENCODED_CHANGELOG" >> $GITHUB_ENV
- name: Upload Build Artifact
uses: actions/upload-artifact@v3 # 安装用于上传最终打包结果到执行完毕界面的脚本
with:
Expand All @@ -67,6 +78,8 @@ jobs:
release_name: Release ${{ github.ref_name }} # 这个是当前release的名称<这个并非像上面一样的完整引用--即不包括`refs/heads/ 或 refs/tags/ 前缀`>。(理论上github.ref_name的值: 如果当前actions是被push/tag触发的, 则会选择tag名; 若仅是push触发, 则会选择分支名)
draft: true # 此项为true, 表示发布的是仅自己可见的草稿(我们可以手动编辑检查后在手动发布)
prerelease: false # 此项若为true, 则会将release打上预发布标志
body: |
$(echo ${{env.CHANGELOG}} | base64 --decode)
- name: Upload Build Artifact to Release
uses: actions/upload-release-asset@v1 # 安装用于上传最终打包结果到本次release的脚本
Expand Down

0 comments on commit 582dac1

Please sign in to comment.