mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-06-07 12:38:11 +08:00
50 lines
1.5 KiB
YAML
50 lines
1.5 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: Find last tag
|
|
id: last_tag
|
|
run: echo "::set-output name=tag::$(git describe --tags --abbrev=0 || echo 'v0.0.0')"
|
|
|
|
- name: Get second latest tag
|
|
id: second_tag
|
|
run: |
|
|
|
|
# 获取倒数第二个标签
|
|
SECOND_LATEST_TAG=$(git tag --list --sort=-version:refname) | awk '{print $2}'
|
|
|
|
# 如果没有倒数第二个标签,则输出为空字符串
|
|
if [[ -z "$SECOND_LATEST_TAG" ]]; then
|
|
echo "::set-output name=tag::"
|
|
else
|
|
echo "::set-output name=tag::$SECOND_LATEST_TAG"
|
|
fi
|
|
|
|
- name: Generate Release Notes
|
|
run: ./bin/genlog.sh -m tag -f -S ${{ steps.second_tag.outputs.tag }} -v ${{ steps.last_tag.outputs.tag }}
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
|
with:
|
|
tag_name: ${{ steps.last_tag.outputs.tag }}
|
|
release_name: Release ${{ steps.last_tag.outputs.tag }}
|
|
body_path: log/${{steps.last_tag.outputs.tag}}.md
|
|
draft: false
|
|
prerelease: false |