From 03a61b0d3ac5bb24db4ad0b1983975a3dcf755b8 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 6 Jun 2017 20:59:16 +0100 Subject: [PATCH] [Dev] Deploy the head commit for a PR to our S3 bucket --- .gitignore | 4 ++++ .travis.yml | 3 ++- package.json | 1 + scripts/deploy_commit.sh | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 scripts/deploy_commit.sh diff --git a/.gitignore b/.gitignore index 8d94c5f93c..ca8c43d23c 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,7 @@ coverage # Use a custom, cached location for Jest to save transpiling # on every PR .jest/cache + +# A commit deploy using `yarn bundle-with-storybooks` generates these +Emission.js +Emission.js.meta diff --git a/.travis.yml b/.travis.yml index 382f4708d0..ac873251a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,9 @@ node_js: - "6.7" script: + - scripts/deploy_commit.sh - yarn ci - - yarn danger + - "# yarn danger" deploy: provider: script diff --git a/package.json b/package.json index eba905d933..d384f6d732 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.ios.js", "scripts": { "bundle": "react-native bundle --config \"$(pwd)\"/rn-cli.config.js --platform=ios --dev=false --entry-file=index.ios.js --bundle-output Pod/Assets/Emission.js --sourcemap-output Pod/Assets/Emission.js.map --assets-dest Pod/Assets && rm -rf Pod/Assets/assets/node_modules", + "bundle-with-storybooks": "react-native bundle --config \"$(pwd)\"/rn-cli.config.js --platform=ios --dev=true --entry-file=Example/Emission/index.ios.js --bundle-output Emission.js --assets-dest Pod/Assets", "clean-example": "cd Example && xcodebuild -workspace Emission.xcworkspace -scheme Emission -destination 'platform=iOS Simulator,name=iPhone 6' clean", "type-check": "tsc --noEmit --pretty", "lint": "tslint 'src/**/*.{ts,tsx}'", diff --git a/scripts/deploy_commit.sh b/scripts/deploy_commit.sh new file mode 100755 index 0000000000..0e8e0fa61d --- /dev/null +++ b/scripts/deploy_commit.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ -z "$TRAVIS_PULL_REQUEST" ]; then + echo "Skipping deploy of the commit" + exit 0 +fi + +# Give us a CLI to work with +yarn global add s3-cli + +# Createa bundle with embedded storybooks also into Emission.js +yarn bundle-with-storybooks + +# Uploads the file to our s3 bucket - credentials are in the ENV vars for same-repo PRs +s3-cli put Emission.js "s3://artsy-emission-js/$TRAVIS_PULL_REQUEST.js"