1 Commits
Author SHA1 Message Date
faumaray 30e669359a Release: clarify lightweight tag rejection
Signed release / publish (push) Failing after 21s
Container CI / release-build (push) Successful in 46m58s
2026-07-26 04:03:52 +03:00
3 changed files with 21 additions and 3 deletions

No files matched your search

+5 -1
View File
@@ -96,11 +96,15 @@ to `stable`; any strict SemVer prerelease goes to `beta`.
```bash ```bash
git config gpg.format ssh git config gpg.format ssh
git config user.signingkey ~/.ssh/echoion-release-maintainer.pub git config user.signingkey ~/.ssh/echoion-release-maintainer
git tag -s -a v1.2.3 -m 'Echoion 1.2.3' git tag -s -a v1.2.3 -m 'Echoion 1.2.3'
test "$(git cat-file -t refs/tags/v1.2.3)" = tag
git push origin v1.2.3 git push origin v1.2.3
``` ```
The private-key path works without an SSH agent. A `.pub` path may be used
instead when its matching private key is already loaded in `ssh-agent`.
`.gitea/workflows/release.yml` rejects a lightweight tag, a non-SSH `.gitea/workflows/release.yml` rejects a lightweight tag, a non-SSH
signature, an untrusted signer, a repository without the exact `v*` protected signature, an untrusted signer, a repository without the exact `v*` protected
tag rule and explicit allowlist, a non-SemVer name, an event object unrelated tag rule and explicit allowlist, a non-SemVer name, an event object unrelated
+5 -1
View File
@@ -87,6 +87,7 @@ if (
fi fi
git -C "$repository" tag lightweight "$target_commit" git -C "$repository" tag lightweight "$target_commit"
lightweight_error="$temporary/lightweight-error.txt"
if ( if (
cd "$repository" cd "$repository"
"$verifier" \ "$verifier" \
@@ -94,10 +95,13 @@ if (
--event-sha "$target_commit" \ --event-sha "$target_commit" \
--allowed-signers "$temporary/allowed-signers" \ --allowed-signers "$temporary/allowed-signers" \
--notes-output "$temporary/lightweight-notes.md" \ --notes-output "$temporary/lightweight-notes.md" \
>/dev/null 2>&1 >/dev/null 2>"$lightweight_error"
); then ); then
printf '%s\n' 'lightweight tag was accepted' >&2 printf '%s\n' 'lightweight tag was accepted' >&2
exit 1 exit 1
fi fi
grep -Fqx \
'verify-gitea-release-tag: lightweight tags are not allowed; create a signed annotated tag' \
"$lightweight_error"
printf '%s\n' 'Gitea signed-tag verification tests passed' printf '%s\n' 'Gitea signed-tag verification tests passed'
+11 -1
View File
@@ -66,7 +66,17 @@ if [[ ! -f "$allowed_signers" || -L "$allowed_signers" ||
fi fi
tag_ref="refs/tags/$tag" tag_ref="refs/tags/$tag"
tag_object=$(git rev-parse --verify "$tag_ref^{tag}") if ! tag_object=$(git rev-parse --verify "$tag_ref"); then
printf '%s\n' \
'verify-gitea-release-tag: tag ref does not exist' >&2
exit 1
fi
if [[ "$(git cat-file -t "$tag_object")" != tag ]]; then
printf '%s\n' \
'verify-gitea-release-tag: lightweight tags are not allowed; create a signed annotated tag' \
>&2
exit 1
fi
tag_target=$( tag_target=$(
git cat-file tag "$tag_object" | git cat-file tag "$tag_object" |
sed -n '1s/^object //p' sed -n '1s/^object //p'