Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed deploying website and homebrew releases.
[ci skip]
  • Loading branch information
brixen committed Jan 4, 2016
1 parent d8e5c64 commit b81c3b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -15,7 +15,7 @@ before_script:
- if [ $TRAVIS_OS_NAME == osx ]; then travis_retry ./configure; fi
script: rake ci
after_success:
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh; fi
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh all; fi
branches:
only:
- master
Expand Down
37 changes: 22 additions & 15 deletions scripts/deploy.sh
Expand Up @@ -85,8 +85,6 @@ function rbx_deploy_homebrew_binary {

rbx_upload_files "$(rbx_binary_bucket)" "$(rbx_release_name)" \
"$(rbx_release_name)" "/homebrew/"

rbx_deploy_homebrew_release
fi
}

Expand Down Expand Up @@ -167,11 +165,11 @@ function rbx_deploy_website_release {
version=$(rbx_revision_version)
url="https://api.github.com/repos/rubinius/rubinius.github.io/contents/_data/releases.yml"

response=$(curl "$url")
response=$(curl "$url?access_token=$GITHUB_OAUTH_TOKEN")

download_url=$(echo "$response" | "$__dir__/json.sh" -b | \
egrep '\["download_url"\][[:space:]]\"[^"]+\"' | egrep -o '\"[^\"]+\"$')
curl -o "$releases" "${download_url:1:${#download_url}-2}"
curl -o "$releases" "${download_url:1:${#download_url}-2}?access_token=$GITHUB_OAUTH_TOKEN"

grep "^- version: \"$version\"\$" "$releases"
if [ $? -eq 0 ]; then
Expand All @@ -193,12 +191,14 @@ EOF
}

function rbx_deploy_homebrew_release {
echo "Deploying Homebrew release $(rbx_revision_version)..."

local release file url response sha

release=$(rbx_release_name)
file="rubinius.rb"
url="https://api.github.com/repos/rubinius/homebrew-apps/contents/$file"
response=$(curl $url)
response=$(curl "$url?access_token=$GITHUB_OAUTH_TOKEN")

cat > "$file" <<EOF
require 'formula'
Expand Down Expand Up @@ -238,14 +238,23 @@ EOF
rm "$file"
}

function rbx_deploy_usage {
cat >&2 <<-EOM
Usage: ${0##*/} [all release github travis homebrew-binary homebrew-release website]
EOM
exit 1
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
if [[ -z $1 ]]; then
"$0" release github travis homebrew website
exit $?
rbx_deploy_usage
fi

for cmd in "${@}"; do
case "$cmd" in
"all")
"$0" release github travis homebrew-binary homebrew-release website
;;
"release")
rbx_deploy_release_tarball "$TRAVIS_OS_NAME"
;;
Expand All @@ -255,19 +264,17 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
"travis")
rbx_deploy_travis_binary "$TRAVIS_OS_NAME"
;;
"homebrew")
"homebrew-binary")
rbx_deploy_homebrew_binary "$TRAVIS_OS_NAME"
;;
"homebrew-release")
rbx_deploy_homebrew_release
;;
"website")
rbx_deploy_website_release "$TRAVIS_OS_NAME"
;;
*)
cat >&2 <<-EOM
Usage: ${0##*/} [release github travis homebrew website]
If no arguments are passed, all deploy tasks are run.
EOM
exit 1
"-h"|"--help"|*)
rbx_deploy_usage
;;
esac
done
Expand Down

0 comments on commit b81c3b6

Please sign in to comment.