[no-relnote] Fix release script

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2024-07-15 14:32:59 +02:00
parent fb6a767ada
commit 49acaef503

View File

@ -138,11 +138,11 @@ else
fi
# TODO: We need to ensure that this tooling also works on `release-*` branches.
if [[ "$FORCE_BRANCH" != "yes" && "$(git rev-parse --abbrev-ref HEAD)" != "main" ]]; then
if [[ "$FORCE" != "yes" ]]; then
if [[ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]]; then
echo "Release scripts should be run on 'main'"
exit 1
fi
git fetch
git diff --quiet FETCH_HEAD
if [[ $? -ne 0 ]]; then
@ -151,6 +151,7 @@ if [[ $? -ne 0 ]]; then
echo "Exiting"
exit 1
fi
fi
# Create a release issue.
echo "Creating release tracking issue"
@ -160,16 +161,21 @@ cat RELEASE.md | sed "s/{{ .VERSION }}/$release/g" | \
--title "Release nvidia-container-toolkit $release" \
--label release
echo "Creating a version bump branch: bump-release-${release}"
git checkout -f -b bump-release-${release}
# Patch versions.mk
LIB_VERSION=${${release%-*}#v}
LIB_TAG=${release#*-}
LIB_VERSION=${release%-*}
LIB_VERSION=${LIB_VERSION#v}
if [[ ${release} == v*-rc.* ]]; then
LIB_TAG_STRING=" ${release#*-}"
else
LIB_TAG_STRING=
fi
echo Patching versions.mk to refer to $release
$SED -i "s/^LIB_VERSION.*$/LIB_VERSION := $LIB_VERSION/" versions.mk
$SED -i "s/^LIB_TAG.*$/LIB_TAG := $LIB_TAG/" versions.mk
$SED -i "s/^LIB_TAG.*$/LIB_TAG :=$LIB_TAG_STRING/" versions.mk
git add versions.mk
git commit -s -m "Bump version for $release release"