Skip to content

Commit bd37187

Browse files
Simon Leungpivotal
authored andcommitted
Update upload-binaries-gocd
Fix regex issues. Signed-off-by: Kris Hicks <[email protected]>
1 parent 678e2f7 commit bd37187

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ci/scripts/upload-binaries-gocd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
1313
fi
1414

1515
s3_config_file=$(pwd)/../../../../cli-ci/ci/s3cfg
16-
filename_regex="cf-cli(-installer)?([-_0-9a-z]+)?\.([a-z]+)"
16+
filename_regex="cf-cli(-installer)?([-_0-9a-z]+)?(\.[a-z]+)?"
1717

1818
ls release
1919

@@ -31,7 +31,7 @@ if [ $? -eq 0 ]; then
3131
os_arch="${BASH_REMATCH[2]}"
3232
extension="${BASH_REMATCH[3]}"
3333
if [ -z "${installer}" ]; then # don't upload edge installers
34-
s3cmd --config=$s3_config_file put $f s3://go-cli/master/cf-cli_edge${os_arch}.${extension}
34+
s3cmd --config=$s3_config_file put $f s3://go-cli/master/cf-cli_edge${os_arch}${extension}
3535
fi
3636
done
3737
fi
@@ -43,16 +43,16 @@ if [ $? -eq 0 ]; then # head is tagged as a release
4343
set -e
4444
echo "Uploading stable" $release_tag "releases"
4545

46-
release_tag=$( echo $match | cut -d'/' -f3 | egrep 'v[0-9]' )
46+
release_tag=$( echo $match | cut -d'/' -f3 | egrep 'v[0-9]' | cut -d'v' -f2 )
4747
for f in $(ls release/cf-cli*);do
4848
[[ $f =~ $filename_regex ]]
4949
installer="${BASH_REMATCH[1]}"
5050
os_arch="${BASH_REMATCH[2]}"
5151
extension="${BASH_REMATCH[3]}"
52-
if [ -z "${installer}" ]; then
53-
s3cmd --config=$s3_config_file put $f s3://go-cli/releases/${release_tag}/cf-cli-installer_${release_tag}${os_arch}.${extension}
52+
if [ -n "${installer}" ]; then
53+
s3cmd --config=$s3_config_file put $f s3://go-cli/releases/${release_tag}/cf-cli_installer_${release_tag}${os_arch}${extension}
5454
else
55-
s3cmd --config=$s3_config_file put $f s3://go-cli/releases/${release_tag}/cf_cli-${release_tag}-${os}-${arch}.${extension}
55+
s3cmd --config=$s3_config_file put $f s3://go-cli/releases/${release_tag}/cf-cli_${release_tag}${os_arch}${extension}
5656
fi
5757
done
5858
fi

0 commit comments

Comments
 (0)