-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(storybook): Added publishing of PR storybook to S3 bucket
- Loading branch information
Michael James
committed
Jun 4, 2017
1 parent
16821bc
commit 999b0bd
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
/coverage | ||
|
||
# production | ||
/build | ||
/dist | ||
|
||
# misc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const execSync = require('child_process').execSync; | ||
|
||
const isPrBuild = (prBranch) => { | ||
return prBranch && prBranch !== "master"; | ||
}; | ||
|
||
const staticSizeNotTooLarge = (staticBookSize) => { | ||
const tenMB = 10 * (2 << 9); | ||
return !isNaN(staticBookSize) && staticBookSize < tenMB; | ||
}; | ||
|
||
const {TRAVIS_PULL_REQUEST_BRANCH: prBranch} = process.env; | ||
console.log(prBranch); | ||
if (isPrBuild(prBranch)) { | ||
const result = execSync(`du -sk storybook-static | sed 's/[^0-9]*//g'`); | ||
const staticBookSize = Number.parseInt(result.toString()); | ||
|
||
if (staticSizeNotTooLarge(staticBookSize)) { | ||
const result = execSync( | ||
`aws s3 cp ${__dirname}/../storybook-static s3://react-audio-vis-prs/${prBranch} --recursive`, | ||
{stdio: [0, 1, 2]} | ||
); | ||
} | ||
} |