添加自定义release
This commit is contained in:
parent
2076652971
commit
d5229c4bea
@ -55,6 +55,7 @@ jobs:
|
|||||||
# 从提交信息中提取 vX.X.X 格式的版本号
|
# 从提交信息中提取 vX.X.X 格式的版本号
|
||||||
VERSION=$(echo "${{ github.event.head_commit.message }}" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')
|
VERSION=$(echo "${{ github.event.head_commit.message }}" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "提取到的版本号: $VERSION"
|
||||||
|
|
||||||
- name: 验证版本号
|
- name: 验证版本号
|
||||||
run: |
|
run: |
|
||||||
@ -75,6 +76,7 @@ jobs:
|
|||||||
BIN_FILES=$(find ./Bin -name "*.bin" -print0 | tr '\0' ',')
|
BIN_FILES=$(find ./Bin -name "*.bin" -print0 | tr '\0' ',')
|
||||||
BIN_FILES=${BIN_FILES%,} # 移除最后一个逗号
|
BIN_FILES=${BIN_FILES%,} # 移除最后一个逗号
|
||||||
echo "bin_files=$BIN_FILES" >> $GITHUB_OUTPUT
|
echo "bin_files=$BIN_FILES" >> $GITHUB_OUTPUT
|
||||||
|
echo "bin_files=$BIN_FILES"
|
||||||
|
|
||||||
- name: 获取上次发布标签
|
- name: 获取上次发布标签
|
||||||
id: get-previous-tag
|
id: get-previous-tag
|
||||||
@ -84,12 +86,34 @@ jobs:
|
|||||||
PREVIOUS_TAG="HEAD~1" # 如果没有上次标签,使用上一次提交
|
PREVIOUS_TAG="HEAD~1" # 如果没有上次标签,使用上一次提交
|
||||||
fi
|
fi
|
||||||
echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
|
echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
|
||||||
|
echo "$PREVIOUS_TAG"
|
||||||
|
|
||||||
- name: 获取提交记录
|
- name: 获取提交记录
|
||||||
id: get-commit-log
|
id: get-commit-log
|
||||||
run: |
|
run: |
|
||||||
COMMIT_LOG=$(git log ${{ steps.get-previous-tag.outputs.previous_tag }}..HEAD --pretty=format:"- %s (%h)" | tr '\n' '\r')
|
COMMIT_LOG=$(git log ${{ steps.get-previous-tag.outputs.previous_tag }}..HEAD --pretty=format:"- %s (%h)" | tr '\n' '\r')
|
||||||
echo "commit_log=$COMMIT_LOG" >> $GITHUB_OUTPUT
|
echo "commit_log=$COMMIT_LOG" >> $GITHUB_OUTPUT
|
||||||
|
echo "commit_log=$COMMIT_LOG"
|
||||||
|
|
||||||
|
- name: 解析Release标题
|
||||||
|
id: parse-release
|
||||||
|
run: |
|
||||||
|
# 获取提交信息
|
||||||
|
commit_message="${{ github.event.head_commit.message }}"
|
||||||
|
# 使用正则表达式提取标题内容
|
||||||
|
release_name=$(echo "$commit_message" | grep -oP 'Release="\K[^"]+')
|
||||||
|
if [ -z "$release_name" ]; then
|
||||||
|
echo "未在提交信息中找到 Release 标题。"
|
||||||
|
release_name="default_release_name"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 获取最终Release信息
|
||||||
|
run: |
|
||||||
|
echo "Version = ${{ steps.extract_version.outputs.version }}"
|
||||||
|
echo "Repo = ${{ github.server_url }}/${{ github.repository }}"
|
||||||
|
echo "TagName = ${{ steps.extract_version.outputs.version }}"
|
||||||
|
echo "ReleaseName = ${{ steps.parse-release.outputs.release_name }}"
|
||||||
|
echo "Body = ${{ steps.get-commit-log.outputs.commit_log }}"
|
||||||
|
|
||||||
- name: 创建Gitea发布
|
- name: 创建Gitea发布
|
||||||
uses: https://gitea.com/actions/gitea-release-action@main
|
uses: https://gitea.com/actions/gitea-release-action@main
|
||||||
@ -98,7 +122,7 @@ jobs:
|
|||||||
gitea_instance_url: ${{ github.server_url }}
|
gitea_instance_url: ${{ github.server_url }}
|
||||||
repository: ${{ github.repository }}
|
repository: ${{ github.repository }}
|
||||||
tag_name: ${{ steps.extract_version.outputs.version }}
|
tag_name: ${{ steps.extract_version.outputs.version }}
|
||||||
release_name: Release ${{ steps.extract_version.outputs.version }}
|
release_name: ${{ steps.parse-release.outputs.release_name }}
|
||||||
body: |
|
body: |
|
||||||
${{ steps.get-commit-log.outputs.commit_log }}
|
${{ steps.get-commit-log.outputs.commit_log }}
|
||||||
draft: false
|
draft: false
|
||||||
|
Loading…
Reference in New Issue
Block a user