Skip to content

Commit e2876e3

Browse files
authored
Merge pull request #2340 from storybooks/cheapsteak/separate-netlify-instances
Separate netlify instances
2 parents f4901bc + 865d193 commit e2876e3

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

scripts/netlify-build.sh

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
#!/bin/sh
22

3-
mkdir netlify-build
3+
# Make sure to set $BUILD_CONTEXT in the Netlify "Deploy Settings"
4+
echo "Building for Netlify. BUILD_CONTEXT: $BUILD_CONTEXT"
45

56
yarn
6-
yarn add gauge --ignore-workspace-root-check # netlify quirk
7+
yarn add gauge --ignore-workspace-root-check # quirk with netlify build instance
78
yarn bootstrap --core
89

9-
echo "netlify-build docs"
10-
pushd docs
11-
yarn install
12-
popd
13-
yarn docs:build
14-
mv docs/public/* netlify-build/
15-
16-
echo "netlify-build React examples"
17-
pushd examples/cra-kitchen-sink
18-
yarn add tapable # netlify quirk
19-
yarn build-storybook
20-
mv storybook-static ../../netlify-build/cra-kitchen-sink
21-
popd
22-
23-
echo "netlify-build Vue examples"
24-
pushd examples/vue-kitchen-sink
25-
yarn build-storybook
26-
mv storybook-static ../../netlify-build/vue-kitchen-sink
27-
popd
28-
10+
if [ "$BUILD_CONTEXT" = "DOCS" ]; then
11+
pushd docs
12+
yarn install
13+
popd
14+
yarn docs:build
15+
mv docs/public netlify-build
16+
elif [ "$BUILD_CONTEXT" = "CRA" ]; then
17+
pushd examples/cra-kitchen-sink
18+
yarn add tapable # quirk with netlify build instance
19+
yarn build-storybook
20+
mv storybook-static ../../netlify-build
21+
popd
22+
elif [ "$BUILD_CONTEXT" = "VUE" ]; then
23+
echo "netlify-build Vue examples"
24+
pushd examples/vue-kitchen-sink
25+
yarn build-storybook
26+
mv storybook-static ../../netlify-build
27+
popd
28+
else
29+
RED='\033[0;31m'
30+
NOCOLOR='\033[0m'
31+
echo "Unrecognized BUILD_CONTEXT \"${RED}$BUILD_CONTEXT${NOCOLOR}\"" 1>&2
32+
fi

0 commit comments

Comments
 (0)