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"
19 pattern
='^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$'
20 echo "$tag" |
grep -e $pattern
22 echo "ERROR: Tag '$tag' doesn't match pattern: $pattern"
25 release_version
=`echo "$tag" | sed 's/llvmorg-//g'`
26 release
=`echo "$release_version" | sed 's/-.*//g'`
27 build_dir
=`echo "$release_version" | sed 's,^[^-]\+,final,' | sed 's,[^-]\+-rc\(.\+\),rc\1,'`
28 rc_flags
=`echo "$release_version" | sed 's,^[^-]\+,-final,' | sed 's,[^-]\+-rc\(.\+\),-rc \1 -test-asserts,' | sed 's,--,-,'`
29 echo "release-version=$release_version" >> $GITHUB_OUTPUT
30 echo "release=$release" >> $GITHUB_OUTPUT
31 echo "build-dir=$build_dir" >> $GITHUB_OUTPUT
32 echo "rc-flags=$rc_flags" >> $GITHUB_OUTPUT
33 echo "upload=$upload" >> $GITHUB_OUTPUT
34 echo "ref=$tag" >> $GITHUB_OUTPUT