Create the git tag before releasing rather than during (#28820)

This commit is contained in:
Arnout Engelen 2020-03-27 11:59:30 +01:00 committed by GitHub
parent b34e26eff0
commit 79b1cda615
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 39 deletions

View file

@ -62,8 +62,9 @@ a snapshot to https://repo.akka.io/snapshots from any branch.
## Release steps
* Do a `project/scripts/release <version>` dry run
* If all goes well, `project/scripts/release --real-run <version>`
* Tag the release: `git tag -am "Version 2.6.x" v2.6.x`
* Do a `project/scripts/release` dry run
* If all goes well, `project/scripts/release --real-run`
* 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
* If all is well, 'release' the staging repo.

View file

@ -76,9 +76,9 @@
#
# Run the script in two stages.
# First a dry run:
# shell> project/scripts/release <version>
# shell> project/scripts/release
# 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
# instructions under release here
@ -117,7 +117,7 @@ declare -r script_dir="$(cd -P "$(dirname "${script_path}")" && pwd)"
function usage {
cat <<EOM
Dry run is be default.
Usage: ${script_name} [options] VERSION
Usage: ${script_name} [options]
-h | --help Print this usage message
-t | --run-tests Run all tests before releasing
-s | --server SERVER Set the release server (default ${default_server})
@ -163,12 +163,6 @@ while true; do
esac
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}"
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..."
safely git reset --hard
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
@ -241,7 +233,13 @@ function try {
"$@" || bail_out "Failed to create release"
}
echolog "Creating release ${version} ..."
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}..."
if [ $dry_run ]; then
echodry "Building everything but not pushing release"
@ -255,14 +253,6 @@ fi
echolog "Checking ssh connection to ${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
try sbt clean
@ -273,6 +263,13 @@ if [ $run_tests ]; then
echolog "All tests are green"
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
echolog "Building the release..."
if [ ! $dry_run ]; then
@ -281,26 +278,18 @@ else
RELEASE_OPT="-Dakka.genjavadoc.enabled=true"
fi
# tag this release
echolog "Tagging..."
try git tag -am "Version ${version}" v${version}
# Release artifacts
try sbt $RELEASE_OPT +buildRelease
echolog "Successfully created released artifacts"
# Build the docs
try sbt $RELEASE_OPT buildDocs
echolog "Successfully created local release"
# 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
echolog "Successfully created docs"
try sbt $RELEASE_OPT whitesourceCheckPolicies
# the point of no return... we're now pushing out to servers
# use a special failure from now on
function arrgh {
cat 1>&2 <<EOM
@ -336,8 +325,8 @@ else
important git push origin --tags
fi
# push the release to the server
echolog "Pushing ${release_dir} to ${publish_path} ..."
# push the docs to the server
echolog "Pushing ${release_dir} docs to ${publish_path} ..."
if [ $dry_run ]; then
echodry "Not actually pushing to server. Commands:"
echodry " sbt $RELEASE_OPT deployRsync"
@ -363,7 +352,6 @@ if [ $dry_run ]; then
git_cleanup
fi
echodry "Successfully created release ${version}"
echodry "See ${release_dir}"
else
echolog "Successfully created release ${version}"
fi