Skip to content

Commit dde4e3a

Browse files
committedJan 4, 2016
Added deploy for Dockerfile updates.
[ci skip]
1 parent c27e77a commit dde4e3a

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed
 

‎scripts/deploy.sh

+53-3
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ EOF
191191
}
192192

193193
function rbx_deploy_homebrew_release {
194+
local os_name=$1
195+
196+
if [[ $os_name != osx ]]; then
197+
return
198+
fi
199+
194200
echo "Deploying Homebrew release $(rbx_revision_version)..."
195201

196202
local release file url response sha
@@ -238,9 +244,50 @@ EOF
238244
rm "$file"
239245
}
240246

247+
function rbx_deploy_docker_release {
248+
local os_name=$1
249+
250+
if [[ $os_name != osx ]]; then
251+
return
252+
fi
253+
254+
echo "Deploying Docker release $(rbx_revision_version)..."
255+
256+
local version release file url response sha
257+
local -a paths=("15.10" "14.04")
258+
259+
version=$(rbx_revision_version)
260+
release=$(rbx_release_name)
261+
file="Dockerfile"
262+
263+
for path in "${paths[@]}"; do
264+
url="https://api.github.com/repos/rubinius/rubinius/contents/dockerfiles/ubuntu/$path/$file"
265+
response=$(curl "$url?access_token=$GITHUB_OAUTH_TOKEN")
266+
267+
cat > "$file" <<EOF
268+
FROM ubuntu:$path
269+
270+
ADD https://rubinius-binaries-rubinius-com.s3-us-west-2.amazonaws.com/ubuntu/$path/x86_64/$release /tmp/rubinius.tar.bz2
271+
RUN apt-get -y install bzip2 && cd /opt && tar xvjf /tmp/rubinius.tar.bz2
272+
273+
ENV PATH /opt/rubinius/$version/bin:/opt/rubinius/$version/gems/bin:\$PATH
274+
275+
CMD ["bash"]
276+
EOF
277+
278+
sha=$(echo "$response" | "$__dir__/json.sh" -b | \
279+
egrep '\["sha"\][[:space:]]\"[^"]+\"' | egrep -o '\"[[:xdigit:]]+\"')
280+
281+
rbx_github_update_file "$file" "${sha:1:${#sha}-2}" \
282+
"Updated Dockerfile for $path to $version.\n\n[ci skip]" "$url"
283+
284+
rm "$file"
285+
done
286+
}
287+
241288
function rbx_deploy_usage {
242289
cat >&2 <<-EOM
243-
Usage: ${0##*/} [all release github travis homebrew-binary homebrew-release website]
290+
Usage: ${0##*/} [all release github travis docker homebrew-binary homebrew-release website]
244291
EOM
245292
exit 1
246293
}
@@ -253,7 +300,7 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
253300
for cmd in "${@}"; do
254301
case "$cmd" in
255302
"all")
256-
"$0" release github travis homebrew-binary homebrew-release website
303+
"$0" release github travis docker homebrew-binary homebrew-release website
257304
;;
258305
"release")
259306
rbx_deploy_release_tarball "$TRAVIS_OS_NAME"
@@ -268,11 +315,14 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
268315
rbx_deploy_homebrew_binary "$TRAVIS_OS_NAME"
269316
;;
270317
"homebrew-release")
271-
rbx_deploy_homebrew_release
318+
rbx_deploy_homebrew_release "$TRAVIS_OS_NAME"
272319
;;
273320
"website")
274321
rbx_deploy_website_release "$TRAVIS_OS_NAME"
275322
;;
323+
"docker")
324+
rbx_deploy_docker_release "$TRAVIS_OS_NAME"
325+
;;
276326
"-h"|"--help"|*)
277327
rbx_deploy_usage
278328
;;

0 commit comments

Comments
 (0)
Please sign in to comment.