Skip to content

Commit 2b6ff7f

Browse files
committedDec 16, 2015
Upload multiple aliases per release because RVM/Travis.
RVM appears to correctly map eg rbx-2 to rubinius-2.6.tar.bz2 unless it's running on Travis. See travis-ci/travis-ci#5294
1 parent da1276d commit 2b6ff7f

File tree

2 files changed

+55
-27
lines changed

2 files changed

+55
-27
lines changed
 

‎scripts/aws.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
# Adapted from https://gist.github.com/chrismdp/6c6b6c825b07f680e710
22
function rbx_s3_upload {
3-
local url bucket path file date acl content_type data signature
3+
local url bucket path dest src date acl content_type data signature
44

55
url=$1
66
bucket=$2
7-
file=$3
8-
path=${4:-/}
7+
dest=$3
8+
src=$4
9+
path=${5:-/}
910

1011
date=$(date +"%a, %d %b %Y %T %z")
1112

1213
acl="x-amz-acl:public-read"
13-
content_type=$(file --mime-type -b $file)
14+
content_type=$(file --mime-type -b "$src")
1415

15-
data="PUT\n\n$content_type\n$date\n$acl\n/$bucket$path$file"
16+
data="PUT\n\n$content_type\n$date\n$acl\n/$bucket$path$dest"
1617
signature=$(echo -en "${data}" |
1718
openssl sha1 -hmac "${AWS_SECRET_ACCESS_KEY}" -binary | base64)
1819

19-
curl -X PUT -T "$file" \
20+
curl -X PUT -T "$src" \
2021
-H "Host: $bucket.s3-us-west-2.amazonaws.com" \
2122
-H "Date: $date" \
2223
-H "Content-Type: $content_type" \
2324
-H "$acl" \
2425
-H "Authorization: AWS ${AWS_ACCESS_KEY_ID}:$signature" \
25-
"$url$path$file"
26+
"$url$path$dest"
2627
}
2728

2829
function rbx_s3_download {

‎scripts/deploy.sh

+47-20
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,98 @@ source "scripts/io.sh"
44
source "scripts/aws.sh"
55
source "scripts/configuration.sh"
66

7-
release_name="rubinius-$(rbx_revision_version).tar.bz2"
8-
9-
file_exts=("" ".md5" ".sha1" ".sha512")
10-
117
function rbx_url_prefix {
128
local bucket=$1
139
echo "https://${bucket}.s3-us-west-2.amazonaws.com"
1410
}
1511

1612
function rbx_upload_files {
17-
local bucket file path url name
13+
local bucket dest src path url name file_exts index
1814

1915
bucket=$1
20-
file=$2
21-
path=${3:-}
16+
dest=$2
17+
src=$3
18+
path=${4:-}
2219
url=$(rbx_url_prefix "$bucket")
20+
file_exts=("" ".md5" ".sha1" ".sha512")
21+
index="index.txt"
2322

24-
rbx_s3_download "$url" "index.txt"
23+
rbx_s3_download "$url" "$index"
2524

2625
# Upload all the files first.
2726
for ext in "${file_exts[@]}"; do
28-
rbx_s3_upload "$url" "$bucket" "$file$ext" "$path" || fail "unable to upload file"
27+
rbx_s3_upload "$url" "$bucket" "$dest$ext" "$src$ext" "$path" ||
28+
fail "unable to upload file"
2929
done
3030

3131
# Update the index and upload it.
3232
for ext in "${file_exts[@]}"; do
3333
if [[ -n $path ]]; then
34-
name="$url$path$file$ext"
34+
name="$url$path$dest$ext"
3535
else
36-
name="$file$ext"
36+
name="$dest$ext"
3737
fi
3838

39-
grep "$name" "index.txt"
39+
grep "$name" "$index"
4040
if [ $? -ne 0 ]; then
41-
echo "$name" >> "index.txt"
41+
echo "$name" >> "$index"
4242
fi
4343
done
4444

45-
rbx_s3_upload "$url" "$bucket" "index.txt" || fail "unable to upload index"
45+
rbx_s3_upload "$url" "$bucket" "$index" "$index" || fail "unable to upload index"
4646
}
4747

4848
# Build and upload the release tarball to S3.
4949
if [[ $TRAVIS_OS_NAME == osx && $CC == gcc && $RVM == "rbx-2" ]]; then
50-
echo "Deploying release tarball ${release_name}..."
50+
echo "Deploying release tarball $(rbx_revision_version)..."
5151

5252
rake release || fail "unable to build release tarball"
5353

5454
bucket="rubinius-releases-rubinius-com"
55+
release_name="rubinius-$(rbx_revision_version).tar.bz2"
5556

56-
rbx_upload_files "$bucket" "$release_name"
57+
rbx_upload_files "$bucket" "$release_name" "$release_name"
5758
fi
5859

5960
# Build and upload a binary to S3.
6061
if [[ $RVM == "rbx-2" ]]; then
61-
echo "Deploying Travis binary ${release_name} for ${TRAVIS_OS_NAME}..."
62+
echo "Deploying Travis binary $(rbx_revision_version) for ${TRAVIS_OS_NAME}..."
6263

6364
rake package:binary || fail "unable to build binary"
6465

6566
bucket="rubinius-binaries-rubinius-com"
67+
revision_version=$(rbx_revision_version)
68+
release_name="rubinius-$revision_version.tar.bz2"
69+
70+
declare -a paths os_releases versions
6671

6772
if [[ $TRAVIS_OS_NAME == linux ]]; then
68-
path="/ubuntu/12.04/x86_64/"
73+
os_releases=("12.04" "14.04" "15.10")
74+
for (( i=0; i < ${#os_releases[@]}; i++ )); do
75+
paths[i]="/ubuntu/${os_releases[i]}/x86_64/"
76+
done
6977
else
70-
path="/osx/10.9/x86_64/"
78+
os_releases=("10.9" "10.10" "10.11")
79+
for (( i=0; i < ${#os_releases[@]}; i++ )); do
80+
paths[i]="/osx/${os_releases[i]}/x86_64/"
81+
done
7182
fi
7283

73-
rbx_upload_files "$bucket" "$release_name" "$path"
84+
IFS="." read -r -a array <<< "$revision_version"
85+
86+
let i=0
87+
version=""
88+
versions[i]=""
89+
90+
for v in "${array[@]}"; do
91+
let i=i+1
92+
versions[i]="-$version$v"
93+
version="$v."
94+
done
95+
96+
for path in "${paths[@]}"; do
97+
for version in "${versions[@]}"; do
98+
rbx_upload_files "$bucket" "rubinius$version.tar.bz2" "$release_name" "$path"
99+
done
100+
done
74101
fi

0 commit comments

Comments
 (0)
Please sign in to comment.