ci: fix version parsing and release backfill
Some checks failed
Secrets CLI - Build & Release / 通知 (push) Successful in 2s
Secrets CLI - Build & Release / Build (x86_64-pc-windows-msvc) (push) Has been cancelled
Secrets CLI - Build & Release / 版本 & Release (push) Failing after 1s
Secrets CLI - Build & Release / 探测 Runner (push) Successful in 0s
Secrets CLI - Build & Release / 质量检查 (fmt / clippy / test) (push) Successful in 21s
Secrets CLI - Build & Release / Build (x86_64-unknown-linux-musl) (push) Has been skipped
Secrets CLI - Build & Release / Build (aarch64-apple-darwin) (push) Has been skipped

Avoid failing the version step when there is no previous tag, and keep creating a release when the tag already exists but the release page is missing.

Made-with: Cursor
This commit is contained in:
voson
2026-03-18 15:00:10 +08:00
parent 0f7c151c89
commit 010001a4f4

View File

@@ -42,7 +42,7 @@ jobs:
run: |
version=$(grep -m1 '^version' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
tag="secrets-${version}"
previous_tag=$(git tag --list 'secrets-*' --sort=-v:refname | grep -vx "$tag" | sed -n '1p')
previous_tag=$(git tag --list 'secrets-*' --sort=-v:refname | awk -v tag="$tag" '$0 != tag { print; exit }')
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
@@ -88,11 +88,6 @@ jobs:
exit 0
fi
if [ "${{ steps.ver.outputs.tag_exists }}" = "true" ]; then
echo "release_id=" >> "$GITHUB_OUTPUT"
exit 0
fi
previous_tag="${{ steps.ver.outputs.previous_tag }}"
if [ -n "$previous_tag" ]; then
changes=$(git log --pretty=format:'- %s (%h)' "${previous_tag}..HEAD")