7
7
8
8
usage () {
9
9
cat << EOH
10
- Usage: ./release.sh [--dry-run] [-h | --help] [--ref <ref>] [--major | --minor | --patch]
10
+ Usage: ./release.sh [--dry-run] [-h | --help] [--ref <ref>] [--major | --minor | --patch] [--force]
11
11
12
12
This script should be called to create a new release.
13
13
33
33
Set --major or --minor to force a larger version bump, even when there are no
34
34
breaking changes. By default a patch version will be created, --patch is no-op.
35
35
36
+ Set --force force the provided increment to be used (e.g. --patch), even if
37
+ there are breaking changes, etc.
38
+
36
39
Set --ref if you need to specify a specific commit that the new version will
37
40
be tagged at, otherwise the latest commit will be used.
38
41
@@ -44,8 +47,9 @@ branch=main
44
47
dry_run=0
45
48
ref=
46
49
increment=
50
+ force=0
47
51
48
- args=" $( getopt -o h -l dry-run,help,ref:,major,minor,patch -- " $@ " ) "
52
+ args=" $( getopt -o h -l dry-run,help,ref:,major,minor,patch,force -- " $@ " ) "
49
53
eval set -- " $args "
50
54
while true ; do
51
55
case " $1 " in
@@ -68,6 +72,10 @@ while true; do
68
72
increment=${1# --}
69
73
shift
70
74
;;
75
+ --force)
76
+ force=1
77
+ shift
78
+ ;;
71
79
--)
72
80
shift
73
81
break
@@ -112,8 +120,12 @@ trap 'log "Check commit metadata failed, you can try to set \"export CODER_IGNOR
112
120
source " $SCRIPT_DIR /release/check_commit_metadata.sh" " $old_version " " $ref "
113
121
trap - EXIT
114
122
123
+ tag_version_args=(--old-version " $old_version " --ref " $ref " --" $increment " )
124
+ if (( force == 1 )) ; then
125
+ tag_version_args+=(--force)
126
+ fi
115
127
log " Executing DRYRUN of release tagging..."
116
- new_version=" $( execrelative ./release/tag_version.sh --old-version " $old_version " --ref " $ref " -- " $increment " --dry-run) "
128
+ new_version=" $( execrelative ./release/tag_version.sh " ${tag_version_args[@]} " --dry-run) "
117
129
log
118
130
read -p " Continue? (y/n) " -n 1 -r continue_release
119
131
log
139
151
log
140
152
# Run without dry-run to actually create the tag, note we don't update the
141
153
# new_version variable here to ensure we're pushing what we showed before.
142
- maybedryrun " $dry_run " execrelative ./release/tag_version.sh --old-version " $old_version " --ref " $ref " -- " $increment " > /dev/null
154
+ maybedryrun " $dry_run " execrelative ./release/tag_version.sh " ${tag_version_args[@]} " > /dev/null
143
155
maybedryrun " $dry_run " git push --tags -u origin " $new_version "
144
156
145
157
if (( dry_run)) ; then
0 commit comments