From 2fca17d64f1a013a3d3ec13eb65fa02c40317ca7 Mon Sep 17 00:00:00 2001 From: MistEO Date: Wed, 3 May 2023 19:57:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dlinux=20CI=20=E5=8F=8A?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=89=88=E6=9C=AC=E5=8F=B7=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 6 +++--- tools/ChangelogGenerator/changelog_generator.py | 4 ++-- tools/version.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02fbb37d57..b6b9877a13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - id: set_tag run: | ${{ startsWith(github.ref, 'refs/pull/') && 'cd temp' || '' }} - echo tag=$(git describe --tags ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT + echo tag=$(git describe --tags --match "v*" ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT exit ${PIPESTATUS[0]} - id: set_pre @@ -65,9 +65,9 @@ jobs: run: | this_tag=${{ steps.set_tag.outputs.tag }} if [[ '${{ steps.set_pre.outputs.prerelease }}' != 'false' ]]; then - last_tag=$(git describe --tags --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}') + last_tag=$(git describe --tags --match "v*" --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}') else - last_tag=$(git describe --tags --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}' --exclude='*-*') + last_tag=$(git describe --tags --match "v*" --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}' --exclude='*-*') fi echo >> CHANGELOG.md echo "**Full Changelog**: [$last_tag -> $this_tag](https://github.com/MaaAssistantArknights/MaaAssistantArknights/compare/${last_tag}...${this_tag})" >> CHANGELOG.md diff --git a/tools/ChangelogGenerator/changelog_generator.py b/tools/ChangelogGenerator/changelog_generator.py index 9bd76cf269..1c1587914d 100644 --- a/tools/ChangelogGenerator/changelog_generator.py +++ b/tools/ChangelogGenerator/changelog_generator.py @@ -211,10 +211,10 @@ def main(tag_name=None, latest=None): pass # 从哪个 tag 开始 if latest == None: - latest = os.popen("git describe --abbrev=0 --tags").read().strip() + latest = os.popen("git describe --tags --match 'v*' --abbrev=0").read().strip() if tag_name == None: - tag_name = os.popen("git describe --tags").read().strip() + tag_name = os.popen("git describe --tags --match 'v*'").read().strip() print("From:", latest, ", To:", tag_name, "\n") # 输出一张好看的 git log 图到控制台 diff --git a/tools/version.sh b/tools/version.sh index d3610e1d10..b392d8a210 100644 --- a/tools/version.sh +++ b/tools/version.sh @@ -4,7 +4,7 @@ LatestTagId=$(git rev-list --tags --max-count=1 --abbrev-commit) LatestCommitId=$(git rev-list --all --max-count=1 --abbrev-commit) if [ $LatestTagId = $LatestCommitId ]; then - Version=$(git describe --tags $LatestTagId) + Version=$(git describe --tags --match "v*" $LatestTagId) else Version="c""$LatestCommitId" fi