Skip to content

Commit e9d9faf

Browse files
committed
release-scripts: allow forced downgrades
In case of regressions, we need a way to force downgrades quickly. The new `--force` flag offers that option. Suggested-by: Matthew John Cheetham <mjcheetham@outlook.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent dfeb3ec commit e9d9faf

3 files changed

Lines changed: 30 additions & 3 deletions

File tree

.github/release-homebrew.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
# Promote a microsoft/git release into the microsoft/homebrew-git tap.
44
#
55
# Usage:
6-
# .github/release-homebrew.sh [<TAG_NAME>]
6+
# .github/release-homebrew.sh [--force] [<TAG_NAME>]
77
#
88
# If TAG_NAME is omitted, the latest microsoft/git release is used.
99
#
10+
# Dowgrades require `--force`.
11+
#
1012
# Prerequisites:
1113
# - `gh` authenticated (via `gh auth login`) as a user with push
1214
# access to microsoft/homebrew-git.
@@ -30,6 +32,11 @@ die () {
3032
exit 1
3133
}
3234

35+
case "$1" in
36+
--force) force=t; shift;;
37+
*) force=;;
38+
esac
39+
3340
TAG_NAME=${1-}
3441
if [ -z "$TAG_NAME" ]; then
3542
echo "==> No tag given; resolving latest microsoft/git release"
@@ -61,8 +68,10 @@ fi
6168
lowest=$(printf '%s\n%s\n' "$version" "$current_version" |
6269
sort -V | sed 1q)
6370
if [ "$lowest" = "$version" ]; then
71+
test -n "$force" ||
6472
die "regression: cask is at $current_version," \
6573
"refusing to downgrade to $version"
74+
echo "warning: **downgrading** from $current_version to $version" >&2
6675
fi
6776

6877
echo "==> Fetching release metadata"

.github/release-vfsforgit.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
# Promote a microsoft/git release into the microsoft/VFSForGit repo.
44
#
55
# Usage:
6-
# .github/release-vfsforgit.sh [<TAG_NAME>]
6+
# .github/release-vfsforgit.sh [--force] [<TAG_NAME>]
77
#
88
# If TAG_NAME is omitted, the latest microsoft/git release is used.
99
#
10+
# Dowgrades require `--force`.
11+
#
1012
# Prerequisites:
1113
# - `gh` authenticated (via `gh auth login`) as a user with push
1214
# access to microsoft/VFSForGit.
@@ -24,6 +26,11 @@ die () {
2426
exit 1
2527
}
2628

29+
case "$1" in
30+
--force) force=t; shift;;
31+
*) force=;;
32+
esac
33+
2734
TAG_NAME=${1-}
2835
if [ -z "$TAG_NAME" ]; then
2936
echo "==> No tag given; resolving latest microsoft/git release"
@@ -56,8 +63,10 @@ fi
5663
lowest=$(printf '%s\n%s\n' "$TAG_NAME" "$current_tag" |
5764
sort -V | sed 1q)
5865
if [ "$lowest" = "$TAG_NAME" ]; then
66+
test -n "$force" ||
5967
die "regression: GIT_VERSION is $current_tag," \
6068
"refusing to downgrade to $TAG_NAME"
69+
echo "warning: **downgrading** from $current_version to $TAG_NAME" >&2
6170
fi
6271

6372
workdir=$(mktemp -d)

.github/release-winget.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
# Promote a microsoft/git release into the microsoft/winget-pkgs repo.
44
#
55
# Usage:
6-
# .github/release-winget.sh [<TAG_NAME>]
6+
# .github/release-winget.sh [--force] [<TAG_NAME>]
77
#
88
# If TAG_NAME is omitted, the latest microsoft/git release is used.
99
#
10+
# Dowgrades require `--force`.
11+
#
1012
# Prerequisites:
1113
# - Runs on Windows (the winget authoring tool wingetcreate.exe is
1214
# Windows-only). Use Git for Windows' bash, an MSYS2 shell, WSL
@@ -47,6 +49,11 @@ Linux)
4749
;;
4850
esac
4951

52+
case "$1" in
53+
--force) force=t; shift;;
54+
*) force=;;
55+
esac
56+
5057
TAG_NAME=${1-}
5158
if [ -z "$TAG_NAME" ]; then
5259
echo "==> No tag given; resolving latest microsoft/git release"
@@ -98,8 +105,10 @@ fi
98105
lowest=$(printf '%s\n%s\n' "$version" "$current_version" |
99106
sort -V | sed 1q)
100107
if [ "$lowest" = "$version" ]; then
108+
test -n "$force" ||
101109
die "regression: package is at $current_version," \
102110
"refusing to downgrade to $version"
111+
echo "warning: **downgrading** from $current_version to $version" >&2
103112
fi
104113

105114
echo "==> Fetching release metadata"

0 commit comments

Comments
 (0)