Create the git tag before releasing rather than during (#28820)
This commit is contained in:
parent
b34e26eff0
commit
79b1cda615
2 changed files with 28 additions and 39 deletions
|
|
@ -62,8 +62,9 @@ a snapshot to https://repo.akka.io/snapshots from any branch.
|
||||||
|
|
||||||
## Release steps
|
## Release steps
|
||||||
|
|
||||||
* Do a `project/scripts/release <version>` dry run
|
* Tag the release: `git tag -am "Version 2.6.x" v2.6.x`
|
||||||
* If all goes well, `project/scripts/release --real-run <version>`
|
* Do a `project/scripts/release` dry run
|
||||||
|
* If all goes well, `project/scripts/release --real-run`
|
||||||
* Log into sonatype, 'close' the staging repo.
|
* Log into sonatype, 'close' the staging repo.
|
||||||
* Test the artifacts by adding `resolvers += "Staging Repo" at "https://oss.sonatype.org/content/repositories/comtypesafe-xxxx"` to a test project
|
* Test the artifacts by adding `resolvers += "Staging Repo" at "https://oss.sonatype.org/content/repositories/comtypesafe-xxxx"` to a test project
|
||||||
* If all is well, 'release' the staging repo.
|
* If all is well, 'release' the staging repo.
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,9 @@
|
||||||
#
|
#
|
||||||
# Run the script in two stages.
|
# Run the script in two stages.
|
||||||
# First a dry run:
|
# First a dry run:
|
||||||
# shell> project/scripts/release <version>
|
# shell> project/scripts/release
|
||||||
# And if all goes well a real run:
|
# And if all goes well a real run:
|
||||||
# shell> project/scripts/release --real-run <version>
|
# shell> project/scripts/release --real-run
|
||||||
#
|
#
|
||||||
# The artifacts published to oss.sonatype.org needs to be released by following the
|
# The artifacts published to oss.sonatype.org needs to be released by following the
|
||||||
# instructions under release here
|
# instructions under release here
|
||||||
|
|
@ -117,7 +117,7 @@ declare -r script_dir="$(cd -P "$(dirname "${script_path}")" && pwd)"
|
||||||
function usage {
|
function usage {
|
||||||
cat <<EOM
|
cat <<EOM
|
||||||
Dry run is be default.
|
Dry run is be default.
|
||||||
Usage: ${script_name} [options] VERSION
|
Usage: ${script_name} [options]
|
||||||
-h | --help Print this usage message
|
-h | --help Print this usage message
|
||||||
-t | --run-tests Run all tests before releasing
|
-t | --run-tests Run all tests before releasing
|
||||||
-s | --server SERVER Set the release server (default ${default_server})
|
-s | --server SERVER Set the release server (default ${default_server})
|
||||||
|
|
@ -163,12 +163,6 @@ while true; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $# != "1" ]; then
|
|
||||||
usage
|
|
||||||
fail "A release version must be specified"
|
|
||||||
fi
|
|
||||||
|
|
||||||
declare -r version=$1
|
|
||||||
declare -r publish_path="${release_server}:${release_path}"
|
declare -r publish_path="${release_server}:${release_path}"
|
||||||
|
|
||||||
JAVA_VERSION=`java -version 2>&1 | grep -E "java version|openjdk version" | cut -d '"' -f2 | cut -d '.' -f1`
|
JAVA_VERSION=`java -version 2>&1 | grep -E "java version|openjdk version" | cut -d '"' -f2 | cut -d '.' -f1`
|
||||||
|
|
@ -215,8 +209,6 @@ function git_cleanup {
|
||||||
echoerr "Cleaning up..."
|
echoerr "Cleaning up..."
|
||||||
safely git reset --hard
|
safely git reset --hard
|
||||||
safely git clean -f
|
safely git clean -f
|
||||||
local tags=$(git tag -l)
|
|
||||||
[[ "${tags}" == *v${version}* ]] && safely git tag -d v${version}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# clean up and fail the script with an error message
|
# clean up and fail the script with an error message
|
||||||
|
|
@ -241,6 +233,12 @@ function try {
|
||||||
"$@" || bail_out "Failed to create release"
|
"$@" || bail_out "Failed to create release"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare -r version=$(get_current_version)
|
||||||
|
|
||||||
|
if [ ${#version} -gt 6 ]; then
|
||||||
|
fail "Version [$version] is too long to be a regular release, have you created a tag?"
|
||||||
|
fi
|
||||||
|
|
||||||
echolog "Creating release ${version}..."
|
echolog "Creating release ${version}..."
|
||||||
|
|
||||||
if [ $dry_run ]; then
|
if [ $dry_run ]; then
|
||||||
|
|
@ -255,14 +253,6 @@ fi
|
||||||
echolog "Checking ssh connection to ${release_server}"
|
echolog "Checking ssh connection to ${release_server}"
|
||||||
try ssh -t ${release_server} echo "Successfully contacted release server."
|
try ssh -t ${release_server} echo "Successfully contacted release server."
|
||||||
|
|
||||||
echolog "Getting current project version from sbt..."
|
|
||||||
declare -r current_version=$(get_current_version)
|
|
||||||
echolog "Current version is ${current_version}"
|
|
||||||
|
|
||||||
if [ "${current_version:0:3}" != "${version:0:3}" ]; then
|
|
||||||
fail "Releasing $version from wrong branch with version $current_version"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# start clean
|
# start clean
|
||||||
try sbt clean
|
try sbt clean
|
||||||
|
|
||||||
|
|
@ -273,6 +263,13 @@ if [ $run_tests ]; then
|
||||||
echolog "All tests are green"
|
echolog "All tests are green"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check binary compatibility for dry run
|
||||||
|
if [ ! $no_mima ] && [ $dry_run ]; then
|
||||||
|
echodry "Running migration manager report..."
|
||||||
|
try sbt $RELEASE_OPT +mimaReportBinaryIssues
|
||||||
|
echodry "Finished migration manager report"
|
||||||
|
fi
|
||||||
|
|
||||||
# build the release
|
# build the release
|
||||||
echolog "Building the release..."
|
echolog "Building the release..."
|
||||||
if [ ! $dry_run ]; then
|
if [ ! $dry_run ]; then
|
||||||
|
|
@ -281,26 +278,18 @@ else
|
||||||
RELEASE_OPT="-Dakka.genjavadoc.enabled=true"
|
RELEASE_OPT="-Dakka.genjavadoc.enabled=true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# tag this release
|
# Release artifacts
|
||||||
echolog "Tagging..."
|
|
||||||
try git tag -am "Version ${version}" v${version}
|
|
||||||
|
|
||||||
try sbt $RELEASE_OPT +buildRelease
|
try sbt $RELEASE_OPT +buildRelease
|
||||||
|
|
||||||
|
echolog "Successfully created released artifacts"
|
||||||
|
|
||||||
|
# Build the docs
|
||||||
try sbt $RELEASE_OPT buildDocs
|
try sbt $RELEASE_OPT buildDocs
|
||||||
|
|
||||||
echolog "Successfully created local release"
|
echolog "Successfully created docs"
|
||||||
|
|
||||||
# check binary compatibility for dry run
|
|
||||||
if [ ! $no_mima ] && [ $dry_run ]; then
|
|
||||||
echodry "Running migration manager report..."
|
|
||||||
try sbt $RELEASE_OPT +mimaReportBinaryIssues
|
|
||||||
echodry "Finished migration manager report"
|
|
||||||
fi
|
|
||||||
|
|
||||||
try sbt $RELEASE_OPT whitesourceCheckPolicies
|
try sbt $RELEASE_OPT whitesourceCheckPolicies
|
||||||
|
|
||||||
# the point of no return... we're now pushing out to servers
|
|
||||||
|
|
||||||
# use a special failure from now on
|
# use a special failure from now on
|
||||||
function arrgh {
|
function arrgh {
|
||||||
cat 1>&2 <<EOM
|
cat 1>&2 <<EOM
|
||||||
|
|
@ -336,8 +325,8 @@ else
|
||||||
important git push origin --tags
|
important git push origin --tags
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# push the release to the server
|
# push the docs to the server
|
||||||
echolog "Pushing ${release_dir} to ${publish_path} ..."
|
echolog "Pushing ${release_dir} docs to ${publish_path} ..."
|
||||||
if [ $dry_run ]; then
|
if [ $dry_run ]; then
|
||||||
echodry "Not actually pushing to server. Commands:"
|
echodry "Not actually pushing to server. Commands:"
|
||||||
echodry " sbt $RELEASE_OPT deployRsync"
|
echodry " sbt $RELEASE_OPT deployRsync"
|
||||||
|
|
@ -363,7 +352,6 @@ if [ $dry_run ]; then
|
||||||
git_cleanup
|
git_cleanup
|
||||||
fi
|
fi
|
||||||
echodry "Successfully created release ${version}"
|
echodry "Successfully created release ${version}"
|
||||||
echodry "See ${release_dir}"
|
|
||||||
else
|
else
|
||||||
echolog "Successfully created release ${version}"
|
echolog "Successfully created release ${version}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue