[no-relnote] Add basic release workflow

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2024-06-17 15:33:11 +02:00
parent e4cdc48854
commit 6358c13dab
7 changed files with 305 additions and 31 deletions

View File

@@ -24,14 +24,12 @@ Usage: $this --reference <tag> [--remote <remote_name>]
Options:
--since specify the tag to start the changelog from (default: latest tag)
--remote specify the remote to fetch tags from (default: upstream)
--version specify the version to be released
--help/-h show this help and exit
EOF
}
REMOTE="upstream"
VERSION=""
REFERENCE=
@@ -44,11 +42,6 @@ while [[ $# -gt 0 ]]; do
shift # past argument
shift # past value
;;
--remote)
REMOTE="$2"
shift # past argument
shift # past value
;;
--version)
VERSION="$2"
shift # past argument
@@ -64,13 +57,22 @@ while [[ $# -gt 0 ]]; do
done
# Fetch the latest tags from the remote
git fetch $REMOTE --tags
remote=$( git remote -v | grep -E "NVIDIA/nvidia-container-toolkit(\.git)?\s" | grep -oE "^[a-z]+" | sort -u )
>&2 echo "Detected remote as '${remote}'"
git fetch ${remote} --tags
# if REFERENCE is not set, get the latest tag
if [ -z "$REFERENCE" ]; then
REFERENCE=$(git describe --tags $(git rev-list --tags --max-count=1))
most_recent_tag=$(git tag --sort=-creatordate | head -1)
if [ "${VERSION}" == "${most_recent_tag}" ]; then
REFERENCE=$(git tag --sort=-creatordate | head -2 | tail -1)
else
REFERENCE=${most_recent_tag}
fi
fi
>&2 echo "Using ${REFERENCE} as previous version"
# Print the changelog
echo "## Changelog"
echo ""