generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 16
Update instructions to use YYYY.WW.REV for release versions. #100
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1003c3c
Update instructions to use YYYY.WW.REV for release versions.
DavidSouther ce531ee
Add stamp.sh file to more sanely advance the version number.
DavidSouther 3264a53
Update README and add --release flag
DavidSouther 76cfcb9
Tighten up several checks.
DavidSouther e1f3d91
Review
DavidSouther File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
DavidSouther marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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}" | ||
DavidSouther marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if [ "$(git remote get-url $REMOTE 2>/dev/null)" != "[email protected]:awsdocs/aws-doc-sdk-examples-tools.git" ] ; then | ||
DavidSouther marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 | ||
DavidSouther marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.