From db0befdc8d8a54b1be44d151c815f6619d430709 Mon Sep 17 00:00:00 2001 From: Sayan Mitra Date: Wed, 10 Jun 2020 08:20:05 +0530 Subject: [PATCH] update build file --- buildspec.yml => buildspec.dev.yml | 2 +- buildspec.prod.yml | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) rename buildspec.yml => buildspec.dev.yml (78%) create mode 100644 buildspec.prod.yml diff --git a/buildspec.yml b/buildspec.dev.yml similarity index 78% rename from buildspec.yml rename to buildspec.dev.yml index 970ef99ffd..515be89b2f 100644 --- a/buildspec.yml +++ b/buildspec.dev.yml @@ -14,7 +14,7 @@ phases: - mv dist/prod.js dist/rudder-analytics.min.js post_build: commands: - - aws s3 cp dist/rudder-analytics.min.js s3://test-js-pipeline/rudder-analytics.min.js --metadata '{"max-age":"3600"}' + - aws s3 cp dist/rudder-analytics.min.js s3://$S3_BUCKET_NAME/rudder-analytics.min.js artifacts: files: - "**/*" \ No newline at end of file diff --git a/buildspec.prod.yml b/buildspec.prod.yml new file mode 100644 index 0000000000..1ad58d7462 --- /dev/null +++ b/buildspec.prod.yml @@ -0,0 +1,23 @@ +version: 0.2 + +phases: + install: + runtime-versions: + nodejs: 10 + build: + commands: + - ls + - npm install --unsafe-perm + - npm run prodTest + - npm run buildProdBrowser + - sed 's|rudder-analytics.min.js.map|https://cdn.rudderlabs.com/rudder-analytics.min.js.map|' dist/rudder-analytics.min.js > dist/prod.js + - mv dist/prod.js dist/rudder-analytics.min.js + post_build: + commands: + - aws s3 cp dist/rudder-analytics.min.js s3://$S3_BUCKET_NAME/rudder-analytics.min.js --metadata '{"Cache-Control":"max-age=3600"}' + - aws s3 cp dist/rudder-analytics.min.js s3://$S3_BUCKET_NAME/v1/rudder-analytics.min.js --metadata '{"Cache-Control":"max-age=3600"}' + - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/v1/rudder-analytics.min.js" + - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/rudder-analytics.min.js" +artifacts: + files: + - "**/*" \ No newline at end of file