mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 06:47:00 +00:00
- 重命名工作流名称以更简洁 - 添加 workflow_dispatch 触发器以支持手动触发 - 简化获取上一个标签的逻辑 - 使用 action-gh-release 替代 github-script 来更新发布日志 - 改进提交记录格式,包含作者信息
38 lines
1.0 KiB
YAML
38 lines
1.0 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
build-release-notes:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get previous tag
|
|
id: prev_tag
|
|
run: |
|
|
PREV_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
|
|
echo "PREV_TAG=$PREV_TAG" >> $GITHUB_ENV
|
|
|
|
- name: Get commits between tags
|
|
id: changelog
|
|
run: |
|
|
git fetch --tags
|
|
COMMITS=$(git log $PREV_TAG..${{ github.event.release.tag_name }} --pretty=format:"- %s (%an)")
|
|
echo "$COMMITS" > commits.txt
|
|
echo "COMMITS<<EOF" >> $GITHUB_ENV
|
|
cat commits.txt >> $GITHUB_ENV
|
|
echo "EOF" >> $GITHUB_ENV
|
|
|
|
- name: Update Release Notes
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.event.release.tag_name }}
|
|
body: |
|
|
${{ env.COMMITS }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |