-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- v5.0
- v4.20
- v4.19
- v4.18
- v4.17
- v4.16
- v4.15
- v4.14
- v4.13
- v4.12
- v4.11
- v4.10
- v4.9
- v4.8
- v4.7
- v4.6
- v4.5
- v4.4
- v4.3
- v4.2
- v4.1
- v4.0
- v3.107
- v3.106
- v3.105
- v3.104
- v3.103
- v3.102
- v3.101
- v3.100
- v3.99
- v3.98
- v3.97
- v3.96
- v3.95
- v3.94
- v3.93
- v3.92
- v3.91
- v3.90
- v3.89
- v3.88
- v3.87
- v3.86
- v3.85
- v3.84
- v3.83
- v3.82
- v3.81
- v3.80
- v3.79
- v3.78
- v3.77
- v3.76
- v3.75
- v3.74
- v3.73
- v3.72
- v3.71
- v3.70
- v3.69
- v3.68
- v3.67
- v3.66
- v3.65
- v3.64
- v3.63
- v3.62
- v3.61
- v3.60
- v3.59
- v3.58
- v3.57
- v3.56
- v3.55
- v3.54
- v3.53
- v3.52
- v3.51
- v3.50
- v3.49
- v3.48
- v3.47
- v3.46
- v3.45
- v3.44
- v3.43
- v3.42
- v3.41
- v3.40
- v3.39
- v3.38
- v3.37
- v3.36
- v3.35
- v3.34
- v3.33
- v3.32
- v3.31
- v3.30
- v3.29
- v3.28
- v3.27
- v3.26
- v3.25
- v3.24
- v3.23
- v3.22
- v3.21
- v3.20
- v3.19
- v3.18
- v3.17
- v3.16
- v3.15
- v3.14
- v3.13
- v3.12
- v3.11
- v3.10
- v3.9
- v3.8
- v3.7
- v3.6
- v3.5
- v3.4
- v3.3
- v3.2
- v3.1
- v3.0
- v2.71828182
- v2.11
- v2.10
- v2.9
- v2.8
- v2.7
- v2.6
- vℇ
Showing
6 changed files
with
168 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,4 @@ | ||
require 'aws-sdk' | ||
require 'pathname' | ||
|
||
desc "Deploy a Rubinius release" | ||
task :deploy do | ||
s3 = Aws::S3::Client.new(region: "us-west-2") | ||
file_exts = ["", ".md5", ".sha1", ".sha512"] | ||
|
||
# TODO: extract the name to a method | ||
basename = "rubinius-#{rbx_version}.tar.bz2" | ||
|
||
# Build and upload the release tarball to S3. | ||
if ENV["TRAVIS_OS_NAME"] == "linux" and ENV["CC"] == "clang" and ENV["RVM"] == "rbx-2" | ||
puts "Deploying release tarball #{basename}..." | ||
|
||
Rake::Task['release'].invoke | ||
|
||
bucket = "rubinius-releases-rubinius-com" | ||
|
||
index = "index.txt" | ||
index_list = s3.get_object(bucket: bucket, key: index).body.read | ||
|
||
file_exts.each do |ext| | ||
name = basename + ext | ||
s3.put_object bucket: bucket, key: name, body: File.read(name) | ||
|
||
index_list << name << "\n" unless index_list =~ /#{name}/ | ||
end | ||
|
||
s3.put_object bucket: bucket, key: index, body: index_list | ||
end | ||
|
||
# Build and upload a binary to S3. | ||
if ENV["RVM"] == "rbx-2" | ||
puts "Deploying Travis binary #{basename}..." | ||
|
||
Rake::Task['package:binary'].invoke | ||
|
||
url_prefix = "https://rubinius-binaries-rubinius-com.s3-us-west-2.amazonaws.com/" | ||
bucket = "rubinius-binaries-rubinius-com" | ||
|
||
if ENV["TRAVIS_OS_NAME"] == "linux" | ||
path_prefix = "ubuntu/12.04/x86_64/" | ||
else | ||
path_prefix = "osx/10.9/x86_64/" | ||
end | ||
|
||
index_list = s3.get_object(bucket: bucket, key: index).body.read | ||
|
||
file_exts.each do |ext| | ||
name = basename + ext | ||
key = path_prefix + name | ||
s3.put_object bucket: bucket, key: key, body: File.read(name) | ||
|
||
path = url_prefix + key | ||
index_list << path << "\n" unless index_list =~ /#{path}/ | ||
end | ||
|
||
s3.put_object bucket: bucket, key: index, body: index_list | ||
end | ||
sh "./scripts/deploy.sh" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Adapted from https://gist.github.com/chrismdp/6c6b6c825b07f680e710 | ||
function rbx_s3_upload { | ||
local url bucket path file date acl content_type data signature | ||
|
||
url=$1 | ||
bucket=$2 | ||
file=$3 | ||
path=${4:-/} | ||
|
||
date=$(date +"%a, %d %b %Y %T %z") | ||
|
||
acl="x-amz-acl:public-read" | ||
content_type="application/octet-stream" | ||
|
||
data="PUT\n\n$content_type\n$date\n$acl\n/$bucket$path$file" | ||
signature=$(echo -en "${data}" | | ||
openssl sha1 -hmac "${AWS_SECRET_ACCESS_KEY}" -binary | base64) | ||
|
||
curl -X PUT -T "$file" \ | ||
-H "Host: $bucket.s3-us-west-2.amazonaws.com" \ | ||
-H "Date: $date" \ | ||
-H "Content-Type: $content_type" \ | ||
-H "$acl" \ | ||
-H "Authorization: AWS ${AWS_ACCESS_KEY_ID}:$signature" \ | ||
"$url$path$file" | ||
} | ||
|
||
function rbx_s3_download { | ||
local url file path | ||
|
||
url=$1 | ||
file=$2 | ||
path=${3:-/} | ||
|
||
curl -o "$file" "$url$path$file" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
function rbx_script_path { | ||
local dir | ||
dir=$(dirname "$0") | ||
|
||
cd "$dir" && pwd | ||
} | ||
|
||
function rbx_git_directory { | ||
echo "$(rbx_script_path)/../.git" | ||
} | ||
|
||
function rbx_revision_file { | ||
echo "$(rbx_script_path)/../.revision" | ||
} | ||
|
||
function rbx_get_revision { | ||
local describe count version commit_count commit_date commit_hash | ||
|
||
if [[ -d $(rbx_git_directory) ]]; then | ||
describe=$(git describe --tags --match=v2* --abbrev=40 --long) | ||
|
||
count=$(echo "$describe" | cut -d - -f 2) | ||
if [[ $count != "0" ]]; then | ||
commit_count=".c$count" | ||
fi | ||
|
||
version=$(echo "$describe" | egrep -o '^v\d+\.\d+' | cut -c 2-) | ||
commit_date=$(git show --format="%ci" HEAD | egrep -o '\d+-\d+-\d+') | ||
commit_hash=$(echo "$describe" | egrep -o '[[:xdigit:]]{8,}$') | ||
|
||
echo "$version$commit_count $commit_date $commit_hash" | ||
elif [[ -f $(rbx_revision_file) ]]; then | ||
cat "$(rbx_revision_file)" | ||
else | ||
echo "X.Y $( date +"%F" ) build" | ||
fi | ||
} | ||
|
||
function rbx_revision_version { | ||
rbx_get_revision | cut -d ' ' -f 1 | ||
} | ||
|
||
function rbx_revision_date { | ||
rbx_get_revision | cut -d ' ' -f 2 | ||
} | ||
|
||
function rbx_revision_hash { | ||
rbx_get_revision | cut -d ' ' -f 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
|
||
source "scripts/io.sh" | ||
source "scripts/aws.sh" | ||
source "scripts/configuration.sh" | ||
|
||
release_name="rubinius-$(rbx_revision_version).tar.bz2" | ||
|
||
file_exts=("" ".md5" ".sha1" ".sha512") | ||
|
||
function rbx_url_prefix { | ||
local bucket=$1 | ||
echo "https://${bucket}.s3-us-west-2.amazonaws.com" | ||
} | ||
|
||
function rbx_upload_files { | ||
local bucket file path url name | ||
|
||
bucket=$1 | ||
file=$2 | ||
path=${3:-} | ||
url=$(rbx_url_prefix "$bucket") | ||
|
||
rbx_s3_download "$url" "index.txt" | ||
|
||
# Upload all the files first. | ||
for ext in "${file_exts[@]}"; do | ||
rbx_s3_upload "$url" "$bucket" "$file$ext" "$path" || fail "unable to upload file" | ||
done | ||
|
||
# Update the index and upload it. | ||
for ext in "${file_exts[@]}"; do | ||
if [[ -n $path ]]; then | ||
name="$url$path$file$ext" | ||
else | ||
name="$file$ext" | ||
fi | ||
|
||
grep "$name" "index.txt" | ||
if [ $? -ne 0 ]; then | ||
echo "$name" >> "index.txt" | ||
fi | ||
done | ||
|
||
rbx_s3_upload "$url" "$bucket" "index.txt" || fail "unable to upload index" | ||
} | ||
|
||
# Build and upload the release tarball to S3. | ||
if [[ $TRAVIS_OS_NAME == linux && $CC == clang && $RVM == "rbx-2" ]]; then | ||
echo "Deploying release tarball ${release_name}..." | ||
|
||
rake release || fail "unable to build release tarball" | ||
|
||
bucket="rubinius-releases-rubinius-com" | ||
|
||
rbx_upload_files "$bucket" "$release_name" | ||
fi | ||
|
||
# Build and upload a binary to S3. | ||
if [[ $RVM == "rbx-2" ]]; then | ||
echo "Deploying Travis binary ${release_name} for ${TRAVIS_OS_NAME}..." | ||
|
||
rake package:binary || fail "unable to build binary" | ||
|
||
bucket="rubinius-binaries-rubinius-com" | ||
|
||
if [[ $TRAVIS_OS_NAME == linux ]]; then | ||
path="ubuntu/12.04/x86_64/" | ||
else | ||
path="osx/10.9/x86_64/" | ||
fi | ||
|
||
rbx_upload_files "$bucket" "$release_name" "$path" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function fail { | ||
local message=$1 | ||
message=${message:=An unhandled error occurred} | ||
echo "$message at ${BASH_SOURCE[1]}:${FUNCNAME[1]} line ${BASH_LINENO[0]}." >&2 | ||
exit 1 | ||
} |