From 76cfcb97e52492588b4b9aaf24e1827e79f71cd9 Mon Sep 17 00:00:00 2001 From: David Souther Date: Tue, 1 Oct 2024 16:24:32 +0200 Subject: [PATCH] Tighten up several checks. --- setup.py | 2 +- stamp.sh | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index c8a8a36..b6ab446 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="aws_doc_sdk_examples_tools", - version="2024.40.2", + version="2024.40.0", packages=["aws_doc_sdk_examples_tools"], package_data={"aws_doc_sdk_examples_tools": ["config/*.yaml"]}, entry_points={ diff --git a/stamp.sh b/stamp.sh index 335f1f5..3b8f3fd 100755 --- a/stamp.sh +++ b/stamp.sh @@ -17,23 +17,26 @@ if [ -n "${STATUS}" ] ; then # exit 1 fi -# VERSION and DATE have the format YYYY.WW.REV, where YYYY is the current year, +# And check that the REMOTE points to the -tools repo. +REMOTE="${REMOTE:origin}" +if [ "$(git remote get-url $REMOTE 2>/dev/null)" != "git@github.com:awsdocs/aws-doc-sdk-examples-tools.git" ] ; then + echo "REMOTE=${REMOTE} is not set to git@github.com:awsdocs/aws-doc-sdk-examples-tools.git, please adjust accordingly and rerun." + exit 1 +fi + +# CURRENT and NEXT have the format YYYY.WW.REV, where YYYY is the current year, # WW is the current week, and REV is the number of releases this week. # The next revision compares the two, in this way -# - If DATE is later than VERSION in all fields, accept date. -# - Otherwise, return VERSION, with one added to REV. +# - If NEXT is later than CURRENT in any fields, accept NEXT. +# - Otherwise, return CURRENT, with one added to REV. # # THIS FUNCTION IS NOT TRANSITIVE! It must be called with # `compare_versions CURRENT NEXT` compare_versions() { - IFS='.' read -r y1 w1 r1 <<< "$1" - IFS='.' read -r y2 w2 r2 <<< "$2" - - if [ "$y1" -lt "$y2" ] || \ - [ "$w1" -lt "$w2" ] || \ - [ "$r1" -lt "$r2" ]; then + if [[ "$1" < "$2" ]] ; then echo "$2" else + IFS='.' read -r y1 w1 r1 <<< "$1" r1=$((r1 + 1)) echo "${y1}.${w1}.${r1}" fi @@ -53,7 +56,7 @@ git add setup.py git commit --message "Release ${VERSION}" if [ "$1" == "--release" ] ; then - git tag $VERSION main - git push origin $VERSION - git push origin main + git tag "$VERSION" main + git push "$REMOTE" "$VERSION" + git push "$REMOTE" main fi