forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle-beta.sh
executable file
·71 lines (60 loc) · 1.77 KB
/
bundle-beta.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Creates our beta bundle for the CDK.
# Assume we have a bootstrapped and packaged repository
set -euo pipefail
root=$PWD
staging="$(mktemp -d)"
cleanup() {
# Clean-up after yourself
echo "Cleaning up staging directory: ${staging}"
cd ${root}
rm -rf ${staging}
}
trap cleanup EXIT
cd ${staging}
echo "Staging: ${staging}"
# Bundle structure
# ================
# aws-cdk-${version}.zip
# ├─ bin
# ├─ docs
# ├─ repo
# │ └ maven
# ├─ y
# │ └─ npm
# ├─ node_modules
# └─ .version
# Creating a `y-npm` registry
echo "Preparing local NPM registry"
mkdir -p y/npm
export Y_NPM_REPOSITORY="${staging}/y/npm"
Y_NPM="${root}/tools/y-npm/bin/y-npm"
for tarball in $(find ${root}/pack -iname '*.tgz'); do
${Y_NPM} publish ${tarball}
done
echo "Installing y-npm" # using y-npm, we're so META!
${Y_NPM} install --global-style --no-save y-npm
# Because y-npm is installed on the build server, we need to bootstrap
# it on windows by manually creating the shim batch file.
cp ${root}/tools/y-npm/bin/y-npm.template.cmd node_modules/.bin/y-npm.cmd
ln -s node_modules/.bin bin
# Create a local maven repository
echo "Preparing local MVN registry"
mkdir -p repo/maven
rsync -av ${root}/packages/aws-cdk-java/maven-repo/ repo/maven/
rsync -av ${root}/node_modules/jsii-java-runtime/maven-repo/ repo/maven/
# Copy the docs website to docs
echo "Copying docs"
cp -r ${root}/packages/aws-cdk-docs/dist/docs docs
# Create an archive under ./dist
echo "Creating ZIP bundle"
version="$(cat ${root}/lerna.json | grep version | cut -d '"' -f4)"
echo ${version} > .version
dist=${root}/dist
output=${dist}/aws-cdk-${version}.zip
rm -fr ${dist}
mkdir -p ${dist}
zip -y -r ${output} .
echo ${output}
# Sign the bundle
/bin/bash $root/sign.sh $output