Skip to content

Commit 576c6ba

Browse files
committed
release-version.sh: add flag to skip branch check
The SciJava ecosystem doesn't have scenarios where we'd want to release from the non-default branch. But this flag makes it possible to try.
1 parent a51f894 commit 576c6ba

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

release-version.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ SCIJAVA_THIRDPARTY_REPOSITORY=$SCIJAVA_BASE_REPOSITORY/thirdparty
3030
# Parse command line options.
3131
BATCH_MODE=--batch-mode
3232
SKIP_VERSION_CHECK=
33+
SKIP_BRANCH_CHECK=
3334
SKIP_LICENSE_UPDATE=
3435
SKIP_PUSH=
3536
SKIP_GPG=
@@ -47,6 +48,7 @@ do
4748
--dry-run) DRY_RUN=echo;;
4849
--no-batch-mode) BATCH_MODE=;;
4950
--skip-version-check) SKIP_VERSION_CHECK=t;;
51+
--skip-branch-check) SKIP_BRANCH_CHECK=t;;
5052
--skip-license-update) SKIP_LICENSE_UPDATE=t;;
5153
--skip-push) SKIP_PUSH=t;;
5254
--tag=*)
@@ -92,6 +94,7 @@ Where <version> is the version to release. If omitted, it will prompt you.
9294
Options include:
9395
--dry-run - Simulate the release without actually doing it.
9496
--skip-version-check - Skips the SemVer and parent pom version checks.
97+
--skip-branch-check - Skips the default branch check.
9598
--skip-license-update - Skips update of the copyright blurbs.
9699
--skip-push - Do not push to the remote git repository.
97100
--dev-version=<x.y.z> - Specify next development version explicitly;
@@ -179,7 +182,11 @@ remote=${upstreamBranch%/*}
179182
defaultBranch=$(git remote show "$remote" | grep "HEAD branch" | sed 's/.*: //')
180183

181184
# Check that we are on the main branch.
182-
test "$currentBranch" = "$defaultBranch" || die "Non-default branch: $currentBranch"
185+
test "$SKIP_BRANCH_CHECK" || {
186+
test "$currentBranch" = "$defaultBranch" || die "Non-default branch: $currentBranch.
187+
If you are certain you want to release from this branch,
188+
try again with --skip-branch-check flag."
189+
}
183190

184191
# If REMOTE is unset, use branch's upstream remote by default.
185192
REMOTE="${REMOTE:-$remote}"

0 commit comments

Comments
 (0)