fix: 更新配置

This commit is contained in:
邹景立 2024-08-04 14:29:56 +08:00
parent c162cdecdc
commit da5ef7c25c
2 changed files with 16 additions and 19 deletions

View File

@ -28,33 +28,28 @@ jobs:
id: last_tag id: last_tag
run: | run: |
# 获取所有标签,按版本排序(降序)
Tags=$(git tag --list --sort=-version:refname) Tags=$(git tag --list --sort=-version:refname)
# 获取倒数第一个标签 # 获取最新的标签(即列表中的第一个)
FRIEST_LATEST_TAG=$(echo "$Tags" | awk 'NR==1 {print $1; exit}') LATEST_TAG=$(echo "$Tags" | awk 'NR==1 {print $1; exit}')
# 获取倒数第二个标签 # 获取倒数第二个标签(如果存在)
SECOND_LATEST_TAG=$(echo "$Tags" | awk 'NR==1 {print $2; exit}') if [[ -n "$Tags" ]]; then
SECOND_LATEST_TAG=$(echo "$Tags" | tac | awk 'NR==1 {print $1; exit}')
# 如果没有倒数第一个标签,则输出为空字符串
if [[ -z "$FRIEST_LATEST_TAG" ]]; then
echo "::set-output name=tag_last::v1.0.0"
else else
echo "::set-output name=tag_last::$FRIEST_LATEST_TAG" SECOND_LATEST_TAG=""
fi fi
# 如果没有倒数第二个标签,则输出为空字符串 # 设置输出变量
if [[ -z "$SECOND_LATEST_TAG" ]]; then echo "::set-output name=tag_last::${LATEST_TAG:-v1.0.0}"
echo "::set-output name=tag_cmd::-S master" echo "::set-output name=tag_cmd::-S ${SECOND_LATEST_TAG:-v1.0.0} "
else
echo "::set-output name=tag_cmd::-S $SECOND_LATEST_TAG"
fi
- name: Generate Release Notes - name: Generate Release Notes
run: | run: |
rm -rf log rm -rf log
newTag=${{ steps.last_tag.outputs.tag_last }} newTag=${{ steps.last_tag.outputs.tag_last }}
git-log -m tag -f ${{ steps.last_tag.outputs.tag_cmd }} -v ${newTag#v} git-log -m tag -f ${{ steps.last_tag.outputs.tag_cmd }}-v ${newTag#v}
- name: Create Release - name: Create Release
id: create_release id: create_release

View File

@ -1,8 +1,10 @@
@echo off @echo off
setlocal setlocal
git pull
echo Deleting remote tags... echo Deleting remote tags...
for /f "delims=" %%x in ('git tag') do git push --delete origin %%x for /f "delims=" %%x in ('git tag') do git push --delete origin %%x
echo Deleting local tags... echo Deleting local tags...
for /f "delims=" %%i in ('git tag') do git tag -d %%i for /f "delims=" %%i in ('git tag') do git tag -d %%i