forked from bcherry/heroku-buildpack-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package_node
executable file
·58 lines (43 loc) · 1.11 KB
/
package_node
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
set -e
node_version="$1"
if [ "$node_version" == "" ]; then
echo "usage: $0 VERSION"
exit 1
fi
if [ "$AWS_ID" == "" ]; then
echo "must set AWS_ID"
exit 1
fi
if [ "$AWS_SECRET" == "" ]; then
echo "must set AWS_SECRET"
exit 1
fi
if [ "$S3_BUCKET" == "" ]; then
echo "must set S3_BUCKET"
exit 1
fi
basedir="$( cd -P "$( dirname "$0" )" && pwd )"
# make a temp directory
tempdir="$( mktemp -t node_XXXX )"
rm -rf $tempdir
mkdir -p $tempdir
pushd $tempdir
# download and extract node
curl http://nodejs.org/dist/node-v${node_version}.tar.gz -o node.tgz
tar xzvf node.tgz
# go into node dir
pushd node-v${node_version}
# build and package nodejs for heroku
vulcan build -v -o $tempdir/node-${node_version}.tgz
# upload nodejs to s3
$basedir/aws/s3 put $S3_BUCKET \
nodejs-${node_version}.tgz $tempdir/node-${node_version}.tgz
# go into scons
pushd tools/scons
# package scons
scons_version=$(ls | grep "scons-local" | cut -d- -f3)
tar czvf $tempdir/scons-${scons_version}.tgz *
# upload scons to s3
$basedir/aws/s3 put $S3_BUCKET \
scons-${scons_version}.tgz $tempdir/scons-${scons_version}.tgz