35 lines · bash
1# Usage: set-release-binary-outputs.sh <github_user> <tag> <upload>2 3set -e4 5if [ -z "$GITHUB_OUTPUT" ]; then6 export GITHUB_OUTPUT=`mktemp`7 echo "Warning: Environment variable GITHUB_OUTPUT is not set."8 echo "Writing output variables to $GITHUB_OUTPUT"9fi10 11tag=$112upload=$213 14if echo $tag | grep -e '^[0-9a-f]\+$'; then15 # This is a plain commit.16 # TODO: Don't hardcode this.17 release_version="18"18 upload='false'19 ref="$tag"20 21else22 23 pattern='^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$'24 echo "$tag" | grep -e $pattern25 if [ $? != 0 ]; then26 echo "ERROR: Tag '$tag' doesn't match pattern: $pattern"27 exit 128 fi29 release_version=`echo "$tag" | sed 's/llvmorg-//g'`30 release=`echo "$release_version" | sed 's/-.*//g'`31fi32echo "release-version=$release_version" >> $GITHUB_OUTPUT33echo "upload=$upload" >> $GITHUB_OUTPUT34echo "ref=$tag" >> $GITHUB_OUTPUT35