diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b6b9ee..9ebe086 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,6 +34,11 @@ jobs: run: | set -euo pipefail [[ "$GITHUB_REF_NAME" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]] + # checkout may fetch the event commit into refs/tags/, replacing + # the local annotated tag with a lightweight ref. Restore the remote + # tag object before checking its type, target, and GitHub signature. + git fetch --force --no-tags origin \ + "refs/tags/$GITHUB_REF_NAME:refs/tags/$GITHUB_REF_NAME" test "$(git cat-file -t "refs/tags/$GITHUB_REF_NAME")" = tag test "$(git rev-parse "refs/tags/$GITHUB_REF_NAME^{commit}")" = "$GITHUB_SHA" test "$(git rev-parse HEAD)" = "$GITHUB_SHA"