1#!/bin/bash 2 3if [[ ! -f WORKSPACE ]] ; then 4 echo 'You must run this command from the top of the workspace.' 5 exit 1 6fi 7 8if [[ ! -f version.bzl ]] ; then 9 version.bzl is missing. 10 exit 1 11fi 12version=$(sed -n -e 's/^version *= *"\(.*\)".*$/\1/p' version.bzl) 13 14# tar on macos builds a file with different checksums each time. 15if [[ $(uname) != 'Linux' ]] ; then 16 echo 'You must run this command from a linux machine.' 17 exit 1 18fi 19 20 21dist_file="/tmp/platforms-${version}.tar.gz" 22tar czf "$dist_file" BUILD LICENSE MODULE.bazel WORKSPACE WORKSPACE.bzlmod version.bzl cpu os host 23sha256=$(shasum -a256 "$dist_file" | cut -d' ' -f1) 24 25path="github.com/bazelbuild/platforms/releases/download/$version/platforms-$version.tar.gz" 26cat <<INP 27 28 291. Create a new release using the tag $version 302. Copy/paste the text below into the release description field. 313. Upload $dist_file as an artifact. 324. Copy $dist_file to the mirror site. 335. Create the release. 346. Update Bazel distdir_deps.bzl to point to this new release. See the readme. 35 36=============== CUT HERE =============== 37**WORKSPACE setup** 38 39\`\`\` 40load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 41http_archive( 42 name = "platforms", 43 urls = [ 44 "https://mirror.bazel.build/${path}", 45 "https://${path}", 46 ], 47 sha256 = "$sha256", 48) 49\`\`\` 50=============== CUT HERE =============== 51 52Use this to update Bazel's distdir_deps.bzl 53 54 55 "archive": "platforms-$version.tar.gz", 56 "sha256": "$sha256", 57 "urls": [ 58 "https://mirror.bazel.build/${path}", 59 "https://${path}", 60 ], 61 62Copy/paste this to mirror the file. 63 64 gsutil cp /tmp/platforms-$version.tar.gz "gs://bazel-mirror/${path}" 65 gsutil setmeta -h "Cache-Control: public, max-age=31536000" "gs://bazel-mirror/${path}" 66 67INP 68