-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathpack.sh
47 lines (39 loc) · 1.35 KB
/
pack.sh
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
#!/usr/bin/env bash
set -ex
# note: test-version-exists.sh checked that we were ready for release in an earlier pipeline stage
CURRENT_TAG=$(git describe --tags | cut -f2 -dv)
# go to previous directory
cd ..
# native source code
tar -cvzf aws-crt-$CURRENT_TAG-source.tgz aws-crt-nodejs/crt
# sha256 checksum
SOURCE_SHA256=$(sha256sum aws-crt-$CURRENT_TAG-source.tgz | awk '{print $1}')
echo -n $SOURCE_SHA256 > aws-crt-$CURRENT_TAG-source.sha256
# omnibus package
tar -cvzf aws-crt-$CURRENT_TAG-all.tgz aws-crt-nodejs/
# sha256 checksum
SOURCE_SHA256=$(sha256sum aws-crt-$CURRENT_TAG-all.tgz | awk '{print $1}')
echo -n $SOURCE_SHA256 > aws-crt-$CURRENT_TAG-all.sha256
# binaries
tar -cvzf aws-crt-$CURRENT_TAG-binary.tgz aws-crt-nodejs/dist/bin
# sha256 checksum
SOURCE_SHA256=$(sha256sum aws-crt-$CURRENT_TAG-binary.tgz | awk '{print $1}')
echo -n $SOURCE_SHA256 > aws-crt-$CURRENT_TAG-binary.sha256
# npm pack
cd aws-crt-nodejs
npm install --unsafe-perm
npm pack --unsafe-perm
cp aws-crt-*.tgz ..
# Check unzip npm package size
cd ..
UNZIP="unzip_pack"
mkdir $UNZIP
tar -xf aws-crt-$CURRENT_TAG.tgz -C $UNZIP
PACK_FILE_SIZE_KB=$(du -sk $UNZIP | awk '{print $1}')
echo "Current package size: ${PACK_FILE_SIZE_KB}"
if expr $PACK_FILE_SIZE_KB \> "$((33000))" ; then
# the package size is too large, return -1
echo "Package size is too large!"
exit -1
fi
exit 0