@@ -17,23 +17,26 @@ if [ -n "${STATUS}" ] ; then
1717 # exit 1
1818fi
1919
20- # VERSION and DATE have the format YYYY.WW.REV, where YYYY is the current year,
20+ # And check that the REMOTE points to the -tools repo.
21+ REMOTE=" ${REMOTE: origin} "
22+ if [
" $( git remote get-url $REMOTE 2> /dev/null) " != " [email protected] :awsdocs/aws-doc-sdk-examples-tools.git" ]
; then 23+ echo " REMOTE=${REMOTE} is not set to [email protected] :awsdocs/aws-doc-sdk-examples-tools.git, please adjust accordingly and rerun." 24+ exit 1
25+ fi
26+
27+ # CURRENT and NEXT have the format YYYY.WW.REV, where YYYY is the current year,
2128# WW is the current week, and REV is the number of releases this week.
2229# The next revision compares the two, in this way
23- # - If DATE is later than VERSION in all fields, accept date .
24- # - Otherwise, return VERSION , with one added to REV.
30+ # - If NEXT is later than CURRENT in any fields, accept NEXT .
31+ # - Otherwise, return CURRENT , with one added to REV.
2532#
2633# THIS FUNCTION IS NOT TRANSITIVE! It must be called with
2734# `compare_versions CURRENT NEXT`
2835compare_versions () {
29- IFS=' .' read -r y1 w1 r1 <<< " $1"
30- IFS=' .' read -r y2 w2 r2 <<< " $2"
31-
32- if [ " $y1 " -lt " $y2 " ] || \
33- [ " $w1 " -lt " $w2 " ] || \
34- [ " $r1 " -lt " $r2 " ]; then
36+ if [[ " $1 " < " $2 " ]] ; then
3537 echo " $2 "
3638 else
39+ IFS=' .' read -r y1 w1 r1 <<< " $1"
3740 r1=$(( r1 + 1 ))
3841 echo " ${y1} .${w1} .${r1} "
3942 fi
@@ -53,7 +56,7 @@ git add setup.py
5356git commit --message " Release ${VERSION} "
5457
5558if [ " $1 " == " --release" ] ; then
56- git tag $VERSION main
57- git push origin $VERSION
58- git push origin main
59+ git tag " $VERSION " main
60+ git push " $REMOTE " " $VERSION "
61+ git push " $REMOTE " main
5962fi
0 commit comments