Commit cb76b44b authored by xuwang's avatar xuwang
Browse files

fix(release): require local RELEASE_BRANCH in sync with remote



Changelog notes are rendered server-side over (latest_tag .. RELEASE_BRANCH]
via the GitLab API, before the release commit is pushed. If local main had
unpushed commits carrying Changelog: trailers, they would be tagged but
absent from CHANGELOG.md. Fetch and compare HEAD to the remote branch in
the preconditions, failing fast with a clear message.

Changelog: fixed

Co-Authored-By: default avatarClaude Opus 4.8 <noreply@anthropic.com>
parent 91be44fd
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -38,6 +38,13 @@ current_branch=$(git rev-parse --abbrev-ref HEAD)

git remote get-url "${REMOTE}" >/dev/null 2>&1 || err "git remote '${REMOTE}' not found (set OTICA_RELEASE_REMOTE)."

# Changelog notes are rendered server-side over (latest_tag .. RELEASE_BRANCH]
# via the GitLab API, so local ${RELEASE_BRANCH} must match the remote — else
# unpushed Changelog-trailer commits land in the tag but not in CHANGELOG.md.
git fetch -q "${REMOTE}" "${RELEASE_BRANCH}" || err "Failed to fetch ${REMOTE}/${RELEASE_BRANCH}."
[ "$(git rev-parse HEAD)" = "$(git rev-parse "${REMOTE}/${RELEASE_BRANCH}")" ] \
    || err "Local ${RELEASE_BRANCH} differs from ${REMOTE}/${RELEASE_BRANCH}. Push or pull first."

if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
    err "Tag ${TAG} already exists."
fi