diff --git a/buildspec.yaml b/buildspec.yaml index bfb5705e05..b23384f617 100644 --- a/buildspec.yaml +++ b/buildspec.yaml @@ -13,7 +13,6 @@ phases: post_build: commands: - "[ -f .BUILD_COMPLETED ] && /bin/bash ./pack.sh" - - "[ -f .BUILD_COMPLETED ] && /bin/bash ./bundle.sh" artifacts: files: - "**/*" diff --git a/bundle.sh b/bundle.sh deleted file mode 100755 index 0247b08af8..0000000000 --- a/bundle.sh +++ /dev/null @@ -1,25 +0,0 @@ - -#!/bin/bash -# Creates our beta bundle for the CDK. -# Assume we have a bootstrapped and packaged repository -set -euo pipefail -root=$PWD - -# Create an archive under ./dist -version="$(node -e "console.log(require('./lerna.json').version)")" - -# CODEBUILD_RESOLVED_SOURCE_VERSION is not defined (i.e. local build or CodePipeline build), -# use the HEAD commit hash -commit="${CODEBUILD_RESOLVED_SOURCE_VERSION:-"$(git rev-parse --verify HEAD)"}" - -cd pack - -# .version is needed by buildable publishers -echo ${version} > .version - -dist=${root}/dist -output=${dist}/jsii-${version}+${commit:0:7}.zip -rm -fr ${dist} -mkdir -p ${dist} -zip -y -r ${output} . -echo ${output} diff --git a/pack.sh b/pack.sh index b1d5477c82..589f1add90 100755 --- a/pack.sh +++ b/pack.sh @@ -1,10 +1,13 @@ #!/bin/bash +# The purpose of this script is to prepare a "dist" directory +# according to the conventions of the Buildable pipeline, so +# that artifacts can be published to the various package managers set -e export PATH=$PWD/node_modules/.bin:$PATH -packdir="$PWD/pack" -rm -fr ${packdir} -mkdir -p ${packdir} +distdir="$PWD/dist" +rm -fr ${distdir} +mkdir -p ${distdir} # run "npm run package" in all modules (which support it) # this should emit a publishable to the "dist" directory of each module @@ -13,6 +16,20 @@ lerna run package --stream # collect all "dist" directories into "pack" for dist in $(lerna exec "[ -d ./dist ] && echo \${PWD}/dist || true"); do echo "collecting ${dist}..." - rsync -av ${dist}/ ${packdir}/ + rsync -av ${dist}/ ${distdir}/ done +# create a build.json file with build metadata +version="$(node -e "console.log(require('./lerna.json').version)")" +cat > ${distdir}/build.json <