Skip to content

Commit 5191197

Browse files
authored
Merge pull request #611 from elezar/fix-generate-changelog
[no-relnote] Fix generate changelog
2 parents eb7983a + 73a6c4d commit 5191197

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

hack/generate-changelog.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ remote=$( git remote -v | grep -E "NVIDIA/nvidia-container-toolkit(\.git)?\s" |
6666
>&2 echo "Detected remote as '${remote}'"
6767
git fetch ${remote} --tags
6868

69-
git tag | grep ${VERSION} > /dev/null
69+
SHA=$(git rev-parse ${VERSION})
7070
if [[ $? -ne 0 ]]; then
71-
>&2 echo "${VERSION} is not a valid git reference, using HEAD"
72-
VERSION=HEAD
71+
SHA="HEAD"
7372
fi
7473

7574
# if REFERENCE is not set, get the latest tag
@@ -87,24 +86,28 @@ fi
8786
# Print the changelog
8887
echo "## What's Changed"
8988
echo ""
89+
if [[ ${VERSION} != v*-rc.* ]]; then
90+
echo "- Promote $REFERENCE to $VERSION"
91+
fi
92+
9093
# Iterate over the commit messages and ignore the ones that start with "Merge" or "Bump"
91-
git log --pretty=format:"%s" $REFERENCE..$VERSION -- ':!deployments/container' ':!tools' | grep -Ev "(^Merge )|(^Bump)|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g'
94+
git log --pretty=format:"%s" $REFERENCE..$SHA -- ':!deployments/container' ':!tools' | grep -Ev "(^Merge )|(^Bump)|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g'
9295

9396
echo ""
9497
echo "### Changes in the Toolkit Container"
9598
echo ""
96-
git log --pretty=format:"%s" $REFERENCE..$VERSION -- deployments/container tools | grep -Ev "(^Merge )|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g'
99+
git log --pretty=format:"%s" $REFERENCE..$SHA -- deployments/container tools | grep -Ev "(^Merge )|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g'
97100

98101
LIB_NVIDIA_CONTAINER_REFERENCE=$( git ls-tree $REFERENCE third_party/libnvidia-container --object-only )
99-
LIB_NVIDIA_CONTAINER_VERSION=$( git ls-tree $VERSION third_party/libnvidia-container --object-only )
102+
LIB_NVIDIA_CONTAINER_VERSION=$( git ls-tree $SHA third_party/libnvidia-container --object-only )
100103

101104
echo ""
102105
if [[ $(git -C third_party/libnvidia-container log --pretty=format:"%s" $LIB_NVIDIA_CONTAINER_REFERENCE..$LIB_NVIDIA_CONTAINER_VERSION | grep -Ev "(^Merge )|(^Bump)|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g' | wc -l) -gt 0 ]]; then
103106
echo "### Changes in libnvidia-container"
104107
echo ""
105108
git -C third_party/libnvidia-container log --pretty=format:"%s" $LIB_NVIDIA_CONTAINER_REFERENCE..$LIB_NVIDIA_CONTAINER_VERSION | grep -Ev "(^Merge )|(^Bump)|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g'
109+
echo ""
106110
fi
107111

108-
echo ""
109112
echo "**Full Changelog**: https://github.com/NVIDIA/nvidia-container-toolkit/compare/${REFERENCE}...${VERSION}"
110113
echo ""

0 commit comments

Comments
 (0)