diff --git a/src/create_java_tools_release.sh b/src/create_java_tools_release.sh index e223e5c9a7cd07..fd3f7702d2a97c 100755 --- a/src/create_java_tools_release.sh +++ b/src/create_java_tools_release.sh @@ -68,6 +68,8 @@ tmp_dir=$(mktemp -d -t 'tmp_bazel_zip_files_XXXXXX') trap "rm -fr $tmp_dir" EXIT gcs_bucket="gs://bazel-mirror/bazel_java_tools" +mirror_prefix="https://mirror.bazel.build/bazel_java_tools" +github_prefix="https://github.com/bazelbuild/java_tools/releases/download" for platform in "linux" "windows" "darwin_x86_64" "darwin_arm64"; do rc_url="release_candidates/java/v${java_tools_version}/java_tools_${platform}-v${java_tools_version}-rc${rc}.zip" @@ -77,13 +79,19 @@ for platform in "linux" "windows" "darwin_x86_64" "darwin_arm64"; do # Make release candidate the release artifact for the current platform. # Don't overwrite existing file. gsutil -q cp -n "${gcs_bucket}/${rc_url}" "${gcs_bucket}/${release_artifact}" + + github_url="${github_prefix}/java_v${java_tools_version}/java_tools_${platform}-v${java_tools_version}.zip" + mirror_url=${mirror_prefix}/${release_artifact} + urls='"mirror_url" : "'${mirror_url}'", "github_url" : "'${github_url}'"' else tmp_url=$(gsutil ls -lh ${gcs_bucket}/tmp/build/${commit_hash}/java/java_tools_${platform}* | sort -k 2 | grep gs -m 1 | awk '{print $4}') # Make the generated artifact a release candidate for the current platform. # Don't overwrite existing file. gsutil -q cp -n ${tmp_url} "${gcs_bucket}/${rc_url}" - release_artifact="${rc_url}" + + mirror_url=${mirror_prefix}/${rc_url} + urls='"mirror_url" : "'${mirror_url}'"' fi # Download the file locally to compute its sha256sum (needed to update the @@ -92,7 +100,8 @@ for platform in "linux" "windows" "darwin_x86_64" "darwin_arm64"; do local_zip="$tmp_dir/java_tools$platform.zip" gsutil -q cp -n ${gcs_bucket}/${rc_url} ${local_zip} file_hash=$(sha256sum ${local_zip} | cut -d' ' -f1) - echo "${release_artifact} ${file_hash}" + + platform_output+='"java_tools_'${platform}'" : {'${urls}', "sha": "'${file_hash}'"},' done rc_url="release_candidates/java/v${java_tools_version}/java_tools-v${java_tools_version}-rc${rc}.zip" @@ -108,16 +117,22 @@ if [[ $release == "true" ]]; then # Copy the associated zip file that contains the sources of the release zip. # Don't overwrite existing file. gsutil -q cp -n "${gcs_bucket}/${rc_sources_url}" "${gcs_bucket}/${release_sources_artifact}" + + github_url="${github_prefix}/java_v${java_tools_version}/java_tools-v${java_tools_version}.zip" + mirror_url=${mirror_prefix}/${release_artifact} + urls='"mirror_url" : "'${mirror_url}'", "github_url" : "'${github_url}'"' else tmp_url=$(gsutil ls -lh ${gcs_bucket}/tmp/build/${commit_hash}/java/java_tools-* | sort -k 2 | grep gs -m 1 | awk '{print $4}') gsutil -q cp -n ${tmp_url} "${gcs_bucket}/${rc_url}" - release_artifact="${rc_url}" # Copy the associated zip file that contains the sources of the release zip. # Don't overwrite existing file. tmp_sources_url=$(gsutil ls -lh ${gcs_bucket}/tmp/sources/${commit_hash}/java/java_tools-* | sort -k 2 | grep gs -m 1 | awk '{print $4}') gsutil -q cp -n ${tmp_sources_url} ${gcs_bucket}/${rc_sources_url} + + mirror_url=${mirror_prefix}/${rc_url} + urls='"mirror_url" : "'${mirror_url}'"' fi # Download the file locally to compute its sha256sum (needed to update the @@ -126,5 +141,9 @@ fi local_zip="$tmp_dir/java_tools.zip" gsutil -q cp -n ${gcs_bucket}/${rc_url} ${local_zip} file_hash=$(sha256sum ${local_zip} | cut -d' ' -f1) -echo "${release_artifact} ${file_hash}" +java_tools_output='"java_tools" : {'${urls}', "sha" : "'${file_hash}'"}' +artifacts='"artifacts" : {'${platform_output}' '${java_tools_output}'}' +version='"version" : "v'${java_tools_version}'"' +release='"release" : "'${release}'"' +echo "{${version}, ${release}, ${artifacts}}" | jq \ No newline at end of file