From 6a6ab58314195d38a0942d506e931a308f9086df Mon Sep 17 00:00:00 2001 From: Tony Aiuto Date: Fri, 26 Aug 2022 15:35:15 -0400 Subject: [PATCH] improve the helper script to make a platforms release --- distro/README.md | 3 ++- distro/makerel.sh | 38 +++++++++++++++++++++++++++----------- version.bzl | 16 ++++++++++++++++ 3 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 version.bzl diff --git a/distro/README.md b/distro/README.md index e4164f7..77fffd6 100644 --- a/distro/README.md +++ b/distro/README.md @@ -5,7 +5,8 @@ WARNING: These are what worked last time. Reality might be different. ## Step 1: Make the release - Pick a new version number -- Run distro/makerel.sh *version* +- Update version.bzl +- Run distro/makerel.sh - Go to the [Releases](https://github.com/bazelbuild/platforms/releases) page - Draft a new release - Name the release with a version number diff --git a/distro/makerel.sh b/distro/makerel.sh index e6f8fe3..7f77f33 100755 --- a/distro/makerel.sh +++ b/distro/makerel.sh @@ -1,16 +1,16 @@ #!/bin/bash -if [[ $# != 1 ]] ; then - echo "usage: $0 version" - exit 1 -fi -version="$1" - if [[ ! -f WORKSPACE ]] ; then echo 'You must run this command from the top of the workspace.' exit 1 fi +if [[ ! -f version.bzl ]] ; then + version.bzl is missing. + exit 1 +fi +version=$(sed -n -e 's/^version *= *"\(.*\)".*$/\1/p' version.bzl) + # tar on macos builds a file with different checksums each time. if [[ $(uname) != 'Linux' ]] ; then echo 'You must run this command from a linux machine.' @@ -19,9 +19,10 @@ fi dist_file="/tmp/platforms-${version}.tar.gz" -tar czf "$dist_file" BUILD LICENSE WORKSPACE cpu os +tar czf "$dist_file" BUILD LICENSE WORKSPACE version.bzl cpu os sha256=$(shasum -a256 "$dist_file" | cut -d' ' -f1) +path="github.com/bazelbuild/platforms/releases/download/$version/platforms-$version.tar.gz" cat <