This repository was archived by the owner on Jun 28, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # make-release-tag.sh: Tag main with a release version.
4+
5+ readonly PROGNAME=$( basename " $0 " )
6+ readonly OLDVERS=" $1 "
7+ readonly NEWVERS=" $2 "
8+
9+ if [ -z " $OLDVERS " ] || [ -z " $NEWVERS " ]; then
10+ printf " Usage: %s OLDVERS NEWVERS\n" " $PROGNAME "
11+ exit 1
12+ fi
13+
14+ set -o errexit
15+ set -o nounset
16+ set -o pipefail
17+
18+ git tag -F - " $NEWVERS " << EOF
19+ Tag $NEWVERS release.
20+
21+ $( git shortlog " $OLDVERS ..HEAD" )
22+ EOF
23+
24+ printf " Created tag '%s'\n" " $NEWVERS "
25+
26+ # People set up their remotes in different ways, so we need to check
27+ # which one to dry run against. Choose a remote name that pushes to the
28+ # projectcontour org repository (i.e. not the user's Github fork).
29+ readonly REMOTE=$( git remote -v | awk ' $2~/projectcontour\/lint/ && $3=="(push)" {print $1}' | head -n 1)
30+ if [ -z " $REMOTE " ]; then
31+ printf " %s: unable to determine remote for %s\n" " $PROGNAME " " projectcontour/lint"
32+ exit 1
33+ fi
34+
35+ readonly BRANCH=$( git branch --show-current)
36+
37+ printf " Testing whether commit can be pushed\n"
38+ git push --dry-run " $REMOTE " " $BRANCH "
39+
40+ printf " Testing whether tag '%s' can be pushed\n" " $NEWVERS "
41+ git push --dry-run " $REMOTE " " $NEWVERS "
42+
43+ printf " Run 'git push %s %s' to push the commit and then 'git push %s %s' to push the tag if you are happy\n" " $REMOTE " " $BRANCH " " $REMOTE " " $NEWVERS "
You can’t perform that action at this time.
0 commit comments