[Workflow] Try to fix code-formatter failing to find changes in some cases.
[llvm-project.git] / .github / workflows / set-release-binary-outputs.sh
blob8a7944e7e55fa06a4ddb5443df00021d00ae324a
1 # Usage: set-release-binary-outputs.sh <github_user> <tag> <upload>
3 set -e
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"
9 fi
11 github_user=$1
12 tag=$2
13 upload=$3
15 if [[ "$github_user" != "tstellar" && "$github_user" != "tru" ]]; then
16 echo "ERROR: User not allowed: $github_user"
17 exit 1
19 pattern='^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$'
20 echo "$tag" | grep -e $pattern
21 if [ $? != 0 ]; then
22 echo "ERROR: Tag '$tag' doesn't match pattern: $pattern"
23 exit 1
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