1 # Usage: set-release-binary-outputs.sh <github_user> <tag> <upload>
5 if [ -z "$GITHUB_OUTPUT" ]; then
6 export GITHUB_OUTPUT
=`mktemp`
7 echo "Warning: Environment variable GITHUB_OUTPUT is not set."
8 echo "Writing output variables to $GITHUB_OUTPUT"
15 if [[ "$github_user" != "tstellar" && "$github_user" != "tru" ]]; then
16 echo "ERROR: User not allowed: $github_user"
20 if echo $tag |
grep -e '^[0-9a-f]\+$'; then
21 # This is a plain commit.
22 # TODO: Don't hardcode this.
27 flags
="-git-ref $tag -test-asserts"
31 pattern
='^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$'
32 echo "$tag" |
grep -e $pattern
34 echo "ERROR: Tag '$tag' doesn't match pattern: $pattern"
37 release_version
=`echo "$tag" | sed 's/llvmorg-//g'`
38 release
=`echo "$release_version" | sed 's/-.*//g'`
39 build_dir
=`echo "$release_version" | sed 's,^[^-]\+,final,' | sed 's,[^-]\+-rc\(.\+\),rc\1,'`
40 rc_flags
=`echo "$release_version" | sed 's,^[^-]\+,-final,' | sed 's,[^-]\+-rc\(.\+\),-rc \1 -test-asserts,' | sed 's,--,-,'`
41 flags
="-release $release $rc_flags"
43 echo "release-version=$release_version" >> $GITHUB_OUTPUT
44 echo "build-dir=$build_dir" >> $GITHUB_OUTPUT
45 echo "flags=$flags" >> $GITHUB_OUTPUT
46 echo "upload=$upload" >> $GITHUB_OUTPUT
47 echo "ref=$tag" >> $GITHUB_OUTPUT