-
Notifications
You must be signed in to change notification settings - Fork 54
/
maven_release
executable file
·34 lines (27 loc) · 1.42 KB
/
maven_release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
#
# Copyright The OpenZipkin Authors
# SPDX-License-Identifier: Apache-2.0
#
set -ue
# This script creates a git `MAJOR.MINOR.PATCH` version tag which later will have `deploy` run against it.
#
# In CI..
# * trigger pattern: tag =~ /^release-[0-9]+\.[0-9]+\.[0-9]+/
# * build-bin/git/login_git must be called before invoking this.
export MAVEN_OPTS="$($(dirname "$0")/maven_opts)"
trigger_tag=${1?trigger_tag is required. Ex release-1.2.3}
release_version=$(build-bin/git/version_from_trigger_tag release- ${trigger_tag})
release_branch=${2:-master}
# Checkout master, as we release from master, not a tag ref
git fetch --no-tags --prune --depth=1 origin +refs/heads/${release_branch}:refs/remotes/origin/${release_branch}
git checkout ${release_branch}
# Ensure no one pushed commits since this release tag as it would fail later commands
commit_local_release_branch=$(git show --pretty='format:%H' ${release_branch})
commit_remote_release_branch=$(git show --pretty='format:%H' origin/${release_branch})
if [ "$commit_local_release_branch" != "$commit_remote_release_branch" ]; then
>&2 echo "${release_branch} on remote 'origin' has commits since the version to release, aborting"
exit 1
fi
# Prepare and push release commits and the version tag (N.N.N), which triggers deployment.
./mvnw --batch-mode -nsu -DreleaseVersion=${release_version} -Denforcer.fail=false -Darguments="-DskipTests -Denforcer.fail=false" release:prepare