Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions .github/workflows/release-sdk-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,28 +403,34 @@ jobs:
echo ""
} > "${NOTES_FILE}"

NOTES_START_TAG_ARG=""
GENERATE_NOTES_FLAG="--generate-notes"
if [[ -n "${PREVIOUS_RELEASE_TAG}" ]]; then
PREVIOUS_NOTES=$(gh release view "sdk-python-${PREVIOUS_RELEASE_TAG}" --json body -q '.body' 2>&1) || {
ERR_MSG="${PREVIOUS_NOTES}"
case "${ERR_MSG}" in
*"release not found"*|*"Not Found"*|*"HTTP 404"*)
PREVIOUS_NOTES='See commit history for changes.'
;;
*)
echo "::warning::Failed to fetch previous release notes: ${ERR_MSG}"
PREVIOUS_NOTES='See commit history for changes.'
;;
esac
}
printf '%s\n' "${PREVIOUS_NOTES}" >> "${NOTES_FILE}"
# Verify the previous tag exists in Git before using --notes-start-tag.
# If a prior release published to PyPI but failed to create a GitHub
# release/tag, the tag won't exist — fall back to static notes to
# avoid failing gh release create after PyPI publish.
if git rev-parse "sdk-python-${PREVIOUS_RELEASE_TAG}" >/dev/null 2>&1; then
NOTES_START_TAG_ARG="--notes-start-tag sdk-python-${PREVIOUS_RELEASE_TAG}"
else
Comment thread
doudouOUC marked this conversation as resolved.
Outdated
echo "::warning::Previous tag sdk-python-${PREVIOUS_RELEASE_TAG} not found; skipping --generate-notes."
Comment thread
doudouOUC marked this conversation as resolved.
Outdated
GENERATE_NOTES_FLAG=""
echo "See commit history for changes." >> "${NOTES_FILE}"
fi
else
# PREVIOUS_RELEASE_TAG is empty for preview/nightly (not computed)
# and for the very first stable release (no prior stable on PyPI).
# Skip --generate-notes to avoid including non-SDK commits.
GENERATE_NOTES_FLAG=""
echo "See commit history for changes." >> "${NOTES_FILE}"
fi

gh release create "${TAG_NAME}" \
--target "${RELEASE_TARGET_SHA}" \
--title "SDK Python Release ${RELEASE_TAG}" \
--notes-file "${NOTES_FILE}" \
${GENERATE_NOTES_FLAG} \
${NOTES_START_TAG_ARG} \
${PRERELEASE_FLAG}

rm -f "${NOTES_FILE}"
Expand Down
Loading