forked from openzipkin/zipkin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maven_release
executable file
·43 lines (36 loc) · 1.92 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
35
36
37
38
39
40
41
42
43
#!/bin/sh
#
# Copyright 2015-2020 The OpenZipkin Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
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