-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update instructions to use YYYY.WW.REV for release versions. #100
base: main
Are you sure you want to change the base?
Changes from all commits
1003c3c
ce531ee
3264a53
76cfcb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/sh | ||
|
||
set -e # Exit on errors | ||
# set -x # Shell debugging | ||
|
||
# First, check that we're on the main branch. | ||
BRANCH=$(git rev-parse --abbrev-rev HEAD) | ||
if [ "$BRANCH" != "main" ] ; then | ||
echo "Not on main, exiting!" | ||
# exit 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll want to uncomment these. |
||
fi | ||
|
||
# And check that the main branch is clean | ||
STATUS=$(git status --porcelain) | ||
if [ -n "${STATUS}" ] ; then | ||
echo "Repository is not clean, exiting!" | ||
# exit 1 | ||
fi | ||
|
||
# And check that the REMOTE points to the -tools repo. | ||
REMOTE="${REMOTE:origin}" | ||
if [ "$(git remote get-url $REMOTE 2>/dev/null)" != "[email protected]:awsdocs/aws-doc-sdk-examples-tools.git" ] ; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fails for me because when I run this manually I get
|
||
echo "REMOTE=${REMOTE} is not set to [email protected]: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 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() { | ||
if [[ "$1" < "$2" ]] ; then | ||
echo "$2" | ||
else | ||
IFS='.' read -r y1 w1 r1 <<< "$1" | ||
r1=$((r1 + 1)) | ||
echo "${y1}.${w1}.${r1}" | ||
fi | ||
} | ||
|
||
# compare_versions 2024.44.4 2024.44.0 # 2024.44.5 | ||
# compare_versions 2024.44.4 2024.45.0 # 2024.45.0 | ||
# compare_versions 2024.44.4 2025.1.0 # 2025.1.0 | ||
|
||
CURRENT=$(grep version= setup.py | awk -F\" '{print $2}') | ||
NEXT=$(date +%Y.%W.0) | ||
VERSION=$(compare_versions "$CURRENT" "$NEXT") | ||
echo "Releasing $VERSION..." | ||
sed -i '' "/version=/ s/$CURRENT/$VERSION/" setup.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The extra |
||
git --no-pager diff | ||
git add setup.py | ||
git commit --message "Release ${VERSION}" | ||
|
||
if [ "$1" == "--release" ] ; then | ||
git tag "$VERSION" main | ||
git push "$REMOTE" "$VERSION" | ||
git push "$REMOTE" main | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description is rather opaque and the linked articles are long, but I see that it boils down to "run stamp.sh, probably with --release".
But maybe a crisper synopsis would help. Even just the comments in stamp.sh about how the tag is formed are probably enough.