mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-06-07 12:38:11 +08:00
68 lines
2.0 KiB
YAML
68 lines
2.0 KiB
YAML
on:
|
|
push:
|
|
# Sequence of patterns matched against refs/tags
|
|
tags:
|
|
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
|
|
|
name: Create Release
|
|
permissions: write-all
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Install dependencies
|
|
run: npm install -g gen-git-log
|
|
|
|
- name: Find Last Tag
|
|
id: last_tag
|
|
run: |
|
|
|
|
Tags=$(git tag --list --sort=-version:refname)
|
|
|
|
# 获取倒数第一个标签
|
|
FRIEST_LATEST_TAG=$(echo "$Tags" | awk 'NR==1 {print $1; exit}')
|
|
|
|
# 获取倒数第二个标签
|
|
SECOND_LATEST_TAG=$(echo "$Tags" | awk 'NR==1 {print $2; exit}')
|
|
|
|
# 如果没有倒数第一个标签,则输出为空字符串
|
|
if [[ -z "$FRIEST_LATEST_TAG" ]]; then
|
|
echo "::set-output name=tag_last::v1.0.0"
|
|
else
|
|
echo "::set-output name=tag_last::$FRIEST_LATEST_TAG"
|
|
fi
|
|
|
|
# 如果没有倒数第二个标签,则输出为空字符串
|
|
if [[ -z "$SECOND_LATEST_TAG" ]]; then
|
|
echo "::set-output name=tag_cmd::"
|
|
else
|
|
echo "::set-output name=tag_cmd::-S $SECOND_LATEST_TAG"
|
|
fi
|
|
|
|
- name: Generate Release Notes
|
|
run: |
|
|
newTag=${{ steps.last_tag.outputs.tag_last }}
|
|
git-log -m tag -f ${{ steps.last_tag.outputs.tag_cmd }} -v ${newTag#1}
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
|
with:
|
|
tag_name: ${{ steps.last_tag.outputs.tag_last }}
|
|
release_name: Release ${{ steps.last_tag.outputs.tag_last }}
|
|
body_path: log/${{steps.last_tag.outputs.tag_last}}.md
|
|
draft: false
|
|
prerelease: false |