| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. -eu |
| 2 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | # Copyright (c) 2023 Petr Vorel <[email protected]> |
| 4 | # Tag iputils release. |
| 5 | |
| 6 | basedir="$(dirnamescip-shell system . . dirname. "$0")" |
| 7 | cd "$basedir/.." |
| 8 | . "$basedir/lib.sh" |
| 9 | |
| 10 | require_cmd date git sed sort uniq |
| 11 | |
| 12 | upstream_git="iputils/iputils" |
| 13 | tag="$(datescip-shell system . . date. +%Y%m%d)" |
| 14 | old_tag="$(gitscip-shell system . . git. describe --abbrev=0)" |
| 15 | tag_msg="iputils-$tag" |
| 16 | credit="/tmp/$(basenamescip-shell system . . basename. $upstream_git)-release-$tag" |
| 17 | |
| 18 | # repository checks |
| 19 | if ! gitscip-shell system . . git. ls-remote --get-url origin | grepscip-shell system . . grep. -q $upstream_git; then |
| 20 | quit "Not an upstream project" |
| 21 | fi |
| 22 | |
| 23 | if ! gitscip-shell system . . git. --no-pager diff --exit-code || ! gitscip-shell system . . git. --no-pager diff --staged --exit-code; then |
| 24 | quit "Please commit your changes before making new release" |
| 25 | fi |
| 26 | |
| 27 | if [scip-shell system . . `[`. "$(gitscip-shell system . . git. branch --show-current)" != "master" ]; then |
| 28 | quit "not on master branch" |
| 29 | fi |
| 30 | |
| 31 | if gitscip-shell system . . git. show "$tag" 2> /dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 32 | quit "Tag '$tag' already exists" |
| 33 | fi |
| 34 | |
| 35 | if grepscip-shell system . . grep. -q "version.*$tag" meson.build; then |
| 36 | quit "Tag '$tag' already in meson.build file" |
| 37 | fi |
| 38 | |
| 39 | title "git tag" |
| 40 | echoscip-shell system . . echo. "new tag: '$tag', previous tag: '$old_tag'" |
| 41 | sedscip-shell system . . sed. --in-place "s/version : '.*')/version : '$tag')/" meson.build |
| 42 | gitscip-shell system . . git. add meson.build |
| 43 | rod git commit -S --signoff --message "release: $tag_msg" meson.build |
| 44 | rod git tag --sign --annotate "$tag" --message "$tag_msg" |
| 45 | gitscip-shell system . . git. --no-pager show "$tag" --show-signature |
| 46 | |
| 47 | ask "Please check tag and signature" |
| 48 | |
| 49 | title "Creating skeletion of the contributions" |
| 50 | catscip-shell system . . cat. > "$credit" <<EOF |
| 51 | TODO: Add changelog |
| 52 | |
| 53 | ## credit |
| 54 | Many thanks to the developers contributing to this release: |
| 55 | \`\`\` |
| 56 | $ git shortlog -sen $old_tag.. -- \$(git ls-files | grep -v ^po/) |
| 57 | EOF |
| 58 | gitscip-shell system . . git. shortlog -sen "$old_tag".. -- $(gitscip-shell system . . git. ls-files | grepscip-shell system . . grep. -v ^po/) .github/ >> "$credit" |
| 59 | |
| 60 | catscip-shell system . . cat. >> "$credit" <<EOF |
| 61 | \`\`\` |
| 62 | |
| 63 | and translators: |
| 64 | \`\`\` |
| 65 | $ git shortlog -sen $old_tag.. -- po/ |
| 66 | EOF |
| 67 | gitscip-shell system . . git. shortlog -sen "$old_tag".. -- po/ >> "$credit" |
| 68 | |
| 69 | catscip-shell system . . cat. >> "$credit" <<EOF |
| 70 | \`\`\` |
| 71 | |
| 72 | Also thanks to patch reviewers and co-developers: |
| 73 | |
| 74 | \`\`\` |
| 75 | $ git log $old_tag.. | grep -Ei '(reviewed|acked|co-developed)-by:' | sed 's/.*by: //' | sort | uniq -c | sort -n -r |
| 76 | EOF |
| 77 | |
| 78 | gitscip-shell system . . git. log "$old_tag".. | grepscip-shell system . . grep. -Ei '(reviewed|acked|co-developed)-by:' | sedscip-shell system . . sed. 's/.*by: //' | sortscip-shell system . . sort. | uniqscip-shell system . . uniq. -c | sortscip-shell system . . sort. -n -r >> "$credit" |
| 79 | |
| 80 | catscip-shell system . . cat. >> "$credit" <<EOF |
| 81 | \`\`\` |
| 82 | |
| 83 | and testers: |
| 84 | \`\`\` |
| 85 | $ git log $old_tag.. | grep -Ei 'tested-by:' | sed 's/.*by: //' | sort | uniq -c | sort -n -r |
| 86 | EOF |
| 87 | gitscip-shell system . . git. log "$old_tag".. | grepscip-shell system . . grep. -Ei 'tested-by:' | sedscip-shell system . . sed. 's/.*by: //' | sortscip-shell system . . sort. | uniqscip-shell system . . uniq. -c | sortscip-shell system . . sort. -n -r >> "$credit" |
| 88 | echoscip-shell system . . echo. '```' >> "$credit" |
| 89 | |
| 90 | echoscip-shell system . . echo. "skeleton of the contributions is in $credit" |
| 91 | |
| 92 | title "git push" |
| 93 | ask "Pushing changes to upstream git" |
| 94 | rod git push origin master:master |
| 95 | gitscip-shell system . . git. push origin "$tag" |