new file mode 100755
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Copyright (c) 2023 Petr Vorel <pvorel@suse.cz>
+
+ask()
+{
+ local msg="$1"
+ local answer
+
+ printf "\n$msg. Proceed? [N/y]: "
+ read answer
+ case "$answer" in
+ [Yy]*) : ;;
+ *) exit 2
+ esac
+}
+
+quit()
+{
+ printf "\n$@\n" >&2
+ exit 1
+}
+
+rod()
+{
+ eval "$@" || quit "$@ failed"
+}
+
+title()
+{
+ echo "===== $1 ====="
+}
new file mode 100755
@@ -0,0 +1,80 @@
+#!/bin/sh
+# Copyright (c) 2023 Petr Vorel <pvorel@suse.cz>
+# Tag LTP release.
+# https://github.com/linux-test-project/ltp/wiki/LTP-Release-Procedure
+set -e
+
+upstream_git="linux-test-project/ltp"
+tag="$(date +%Y%m%d)"
+old_tag="$(git describe --abbrev=0)"
+tag_msg="LTP $tag"
+relnotes="/tmp/$(basename $upstream_git)-release-$tag"
+
+. $(dirname "$0")/lib.sh
+
+cd $(dirname "$0")/..
+
+if ! git ls-remote --get-url origin | grep -q $upstream_git; then
+ quit "Not an upstream project"
+fi
+
+if ! git --no-pager diff --exit-code; then
+ quit "Please commit your changes before making new release"
+fi
+
+if git show $tag 2> /dev/null; then
+ quit "Tag '$tag' already exists"
+fi
+
+if grep -q "$tag" VERSION; then
+ quit "Tag '$tag' already in VERSION file"
+fi
+
+title "git tag"
+echo "new tag: '$tag', previous tag: '$old_tag'"
+echo "$tag" > VERSION
+git add VERSION
+rod git commit -S --signoff --message \"$tag_msg\" VERSION
+rod git tag --sign --annotate $tag --message \"$tag_msg\"
+git --no-pager show $tag --show-signature
+
+ask "Please check tag and signature"
+
+title "Creating skeleton file for release notes"
+cat > $relnotes <<EOF
+TODO: Add changelog
+
+## credit
+Many thanks to the people contributing to this release:
+\`\`\`
+ $ git shortlog -sen $old_tag..
+EOF
+git shortlog -s -n $old_tag.. >> $relnotes
+
+cat >> $relnotes <<EOF
+\`\`\`
+
+Also thanks to patch reviewers:
+
+$ git log $old_tag.. | grep -Ei '(reviewed|acked)-by:' | sed 's/.*by: //' | sort | uniq -c | sort -n -r
+\`\`\`
+EOF
+
+git log $old_tag.. | grep -Ei '(reviewed|acked)-by:' | sed 's/.*by: //' | sort | uniq -c | sort -n -r >> $relnotes
+
+cat >> $relnotes <<EOF
+\`\`\`
+
+and testers:
+$ git log $old_tag.. | grep -Ei 'tested-by:' | sed 's/.*by: //' | sort | uniq -c | sort -n -r
+\`\`\`
+EOF
+git log $old_tag.. | grep -Ei 'tested-by:' | sed 's/.*by: //' | sort | uniq -c | sort -n -r >> $relnotes
+echo '```' >> $relnotes
+
+echo "Skeleton file for release notes: $relnotes"
+
+title "git push"
+ask "Pushing changes to upstream git"
+rod git push origin master:master
+git push origin $tag
A helper for new releases. Functions will be reused in another script (next commit). Signed-off-by: Petr Vorel <pvorel@suse.cz> --- tools/lib.sh | 31 +++++++++++++++++ tools/tag-release.sh | 80 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100755 tools/lib.sh create mode 100755 tools/tag-release.sh