Skip to content

Commit b81c3b6

Browse files
committedJan 4, 2016
Fixed deploying website and homebrew releases.
[ci skip]
1 parent d8e5c64 commit b81c3b6

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed
 

Diff for: ‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ before_script:
1515
- if [ $TRAVIS_OS_NAME == osx ]; then travis_retry ./configure; fi
1616
script: rake ci
1717
after_success:
18-
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh; fi
18+
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh all; fi
1919
branches:
2020
only:
2121
- master

Diff for: ‎scripts/deploy.sh

+22-15
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ function rbx_deploy_homebrew_binary {
8585

8686
rbx_upload_files "$(rbx_binary_bucket)" "$(rbx_release_name)" \
8787
"$(rbx_release_name)" "/homebrew/"
88-
89-
rbx_deploy_homebrew_release
9088
fi
9189
}
9290

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

170-
response=$(curl "$url")
168+
response=$(curl "$url?access_token=$GITHUB_OAUTH_TOKEN")
171169

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

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

195193
function rbx_deploy_homebrew_release {
194+
echo "Deploying Homebrew release $(rbx_revision_version)..."
195+
196196
local release file url response sha
197197

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

203203
cat > "$file" <<EOF
204204
require 'formula'
@@ -238,14 +238,23 @@ EOF
238238
rm "$file"
239239
}
240240

241+
function rbx_deploy_usage {
242+
cat >&2 <<-EOM
243+
Usage: ${0##*/} [all release github travis homebrew-binary homebrew-release website]
244+
EOM
245+
exit 1
246+
}
247+
241248
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
242249
if [[ -z $1 ]]; then
243-
"$0" release github travis homebrew website
244-
exit $?
250+
rbx_deploy_usage
245251
fi
246252

247253
for cmd in "${@}"; do
248254
case "$cmd" in
255+
"all")
256+
"$0" release github travis homebrew-binary homebrew-release website
257+
;;
249258
"release")
250259
rbx_deploy_release_tarball "$TRAVIS_OS_NAME"
251260
;;
@@ -255,19 +264,17 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
255264
"travis")
256265
rbx_deploy_travis_binary "$TRAVIS_OS_NAME"
257266
;;
258-
"homebrew")
267+
"homebrew-binary")
259268
rbx_deploy_homebrew_binary "$TRAVIS_OS_NAME"
260269
;;
270+
"homebrew-release")
271+
rbx_deploy_homebrew_release
272+
;;
261273
"website")
262274
rbx_deploy_website_release "$TRAVIS_OS_NAME"
263275
;;
264-
*)
265-
cat >&2 <<-EOM
266-
Usage: ${0##*/} [release github travis homebrew website]
267-
268-
If no arguments are passed, all deploy tasks are run.
269-
EOM
270-
exit 1
276+
"-h"|"--help"|*)
277+
rbx_deploy_usage
271278
;;
272279
esac
273280
done

0 commit comments

Comments
 (0)
Please sign in to comment.